April 2021
1 min
What happens when you are tracking a file or a folder on your git repository, but you no longer want to? Or maybe you even added it by accident or forgot to add it to your .gitignore
file?
You can start by adding it to your .gitignore
file, but this won't stop git to keep track of it because it's already on the repo. To stop the tracking you ned to remove it from the index.
For a file:
git rm --cached <file-name.extension>
For a folder:
git rm -r --cached <folder-name>
That will do it! Just remember that this won't remove the file on your computer, but it will in a different computer when you retrieve the files from the repo by git pull
.