Untrack files from git temporarily

agent.smith picture agent.smith · Aug 6, 2011 · Viewed 436k times · Source

I have setup a local git on my machine. When I initialized git, I added pre-compiled libs and binaries. However, now during my development I don't want to check in those files intermittently. I dont want to remove these files from repo. Is there any way to not keep a track of these files till I complete my development. (I think I can not use .gitignore as it works only for those files which are not in git. I want to temporarily disable tracking of files.)

Answer

Andy picture Andy · Aug 6, 2011

git update-index should do what you want

This will tell git you want to start ignoring the changes to the file
git update-index --assume-unchanged path/to/file

When you want to start keeping track again
git update-index --no-assume-unchanged path/to/file

Github Documentation: update-index