Thursday, 27 December 2018

GIT: Why can't I ignore certain files wiht .git/info/exclude?

What you want to is to ignore changes on tracked files. This cannot achieved (as Charles Bailey says) correctly, neither with .gitignore nor with .git/info/exclude.

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]"


h s m r c k is one of status of git files. All the assume-unchanged files have lower case status code.


use on certain file patterns:

git update-index --assume-unchanged -- $(git ls-files '*.properties')

git update-index --assume-unchanged -- $(git ls-files '*.classpath')

0 comments:

Post a Comment