Thursday 6 October 2016

Constantly ignore file changes in git without changing .gitignore

(original from "eckes" on stackoverflow: http://stackoverflow.com/questions/10879783/git-doesnt-ignore-2-specifically-named-files?answertab=active#tab-top)
You'll need to use git update-index:
git update-index --assume-unchanged build/conf/a.conf
git update-index --assume-unchanged build/conf/b.conf
will achieve what you want: the files are always assumed unchanged.
If you want to track changes in these files again, use --no-assume-unchanged.
Finally, if you want to know which files are currently in the --assume-unchanged mode, ask git for
git ls-files -v | grep -e "^[hsmrck]"