2

I force checked in a gitignored file using git add -f. It doesn't belong in there and now I need to remove it from the repo. Is this possible?

Musical Shore
  • 1,272
  • 3
  • 19
  • 37
  • Possible duplicate of [Remove a file from a Git repository without deleting it from the local filesystem](http://stackoverflow.com/questions/1143796/remove-a-file-from-a-git-repository-without-deleting-it-from-the-local-filesyste) – Alik Nov 12 '15 at 05:50

1 Answers1

3

You can git rm --cached it: it removes it from the git repo while keeping the file one the disk.

If you had already committed that file, you would then make a new commit recording the deletion of that same file.

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755