Morning Dose of Git

Some fool has checked .settings, .project, and myCrazyProductionDB.properties files into your git repo. You can add them to .gitignore, but they’ll still show up as modified because they are already being tracked. If you really can’t delete them, you can at least stop tracking them with:

$ git update-index --assume-unchanged <file>

A Simple Example

$ git update-index --assume-unchanged .classpath

If Git needs to modify the file, it will fail gracefully. To merge changes, you’ll have to un-mark it as assume-unchanged.

To see which files you’ve marked:

$ git ls-files -v | grep "^[[:lower:]]"
h .classpath

This works because ls-files -v prints the marked file in lower-case.

Re-mark the file with:

$ git update-index --no-assume-unchanged .classpath
share this:Email this to someoneTweet about this on TwitterShare on LinkedInShare on Facebook