Reputation: 103
Already tried doing git rm --cached dir/file
and it did not work.
It only works with the VSCode interface(the source control extension).
I'll add a file to .gitignore
git add .
git commit -m "trying to make .gitignore work"
git push
And no success...
I already visited all the other duplicates of this one on Stackoverflow.
I am using WSL (Windows Subsystem for Linux) on VScode.
The file remains on my git repo even if its marked on gitignore...
The file name on VScode interface shows up a little gray indicating that .gitignore
worked...
Upvotes: 1
Views: 143
Reputation: 1328592
git rm --cached dir/file
should work, provided you do a commit and a push.
Note that the --cached
option means the file remains on your disk.
And that it is removed (and ignored) only for this new commits (and the future ones), not the past commits.
Also check if, locally, the .gitignore rule applies with:
git check-ignore -v -- dir/file
No output means: it is not ignored.
Upvotes: 1