Git – How to Stop Tracking a File Without Removing It from Repo

git

I have a config file which I want to keep on the remote repository, but I don't want to track its changes on my computer. Adding it to .gitignore doesn't do the trick.

The reason I don't want to track changes is because it's supposed to differ between computers depending on their environment.

Best Answer

If you want to temporarily stop tracking a file, you can still use

git update-index --assume-unchanged <file>
// track changes again :
git update-index --no-assume-unchanged <file>