Last Updated: February 25, 2016
·
1K
· amacgregor

GIT: ignore changes in tracked files

Sometimes you might want to made changes in tracked files for example db configuration files and of course you don't want this changes committed, now we could add the file to the .gitignore file but since the file is already tracked git will try to commit the changes regardless of whats in the .gitignore file.

Git has a very simple solution for this:

git update-index --assume-unchanged <file_name>

And if we want to start tracking the changes on the file again we just need to do:

git update-index --no-assume-unchanged <file_name>