If I have a repo with files that were previously not in my .gitignore
file that I now want to ignore, how do I do this without deleting the files locally and when you pull from the repo?
Asked
Active
Viewed 44 times
1

Jamie
- 1,909
- 3
- 22
- 47
-
1Does this answer your question? [How to make Git "forget" about a file that was tracked but is now in .gitignore?](https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore) – phd Jan 29 '20 at 07:15
1 Answers
2
git rm --cached somefile
will preserve the local copy of the file but make git stop tracking that file. Once you do that, you can add the file to .gitignore
too.
-
-
Yep, that's unavoidable. Even if you just switch to a different branch and then back the file will be removed. – phd Jan 29 '20 at 08:26