How to untrack files in GIT
I accidentally commit some files that should not be tracked, e.g. folder .gradle
, IntelliJ IDEA project file *.iml…
Obviously that’s not good. Searching around, I found a thread in SOF,
in summary:
- Step 1:
git rm --cached <files/folders>
- Step 2:
git update-index --no-assume-unchanged <files/folders>
- Step 3: Add to
.gitignore
Sound good, but doesn’t work!
This is working:
- Step 1 (remove all from index):
git rm -r --cached .
- Step 2 (add again):
git add .
- Step 3:
git commit -m "fixing .gitignore"