Skip to content

Instantly share code, notes, and snippets.

@eltimn
Created February 26, 2014 16:24
Show Gist options
  • Save eltimn/9232958 to your computer and use it in GitHub Desktop.
Save eltimn/9232958 to your computer and use it in GitHub Desktop.
GIT: ignoring changes in tracked files
There may be times when you want to edit some variables in for example a database connection file, to run an application right from within your GIT repo. Of course you don’t wont those changes to be commited, so you add the file the .gitignore.
However adding tracked files to .gitignore won’t work because GIT will still track the changes and commit the file if you use the -a parameter.
Fortunately GIT has a very easy solution for this, just run the following command on the file or path you want to ignore the changes of:
git update-index --assume-unchanged <file>
If you wanna start tracking changes again run the following command:
git update-index --no-assume-unchanged <file>
You can find more info about this in the git manual.
Happy GITting ;)
SOURCE: http://blog.pagebakers.nl/2009/01/29/git-ignoring-changes-in-tracked-files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment