Untracking files in Git
2023-06-10git
Normally you can avoid tracking files in Git by adding files to .gitignore
.
But if files have been previously added for tracking, they will still be tracked even after appending them to .gitignore
.
We need to first remove tracked files from cache. And add back all the files – including .gitignore
– in the current directory. Now .gitignore
will take effect.
git rm -r --cached .
git add .