GIT -- Exclude / Ignore Files from commit [duplicate]
Here is my answer from a similar question.
git update-index should do what you want
This will tell git you want to start ignoring the changes to the file
git update-index --assume-unchanged path/to/file
When you want to start keeping track again
git update-index --no-assume-unchanged path/to/file
Another solution is to use a pre-commit
hook. See git help hooks
for details.
This is harder to set up: you have to write a shell script to express exactly what you want to allow or disallow, which probably means you need to have a fairly good grasp of git.
It's more permanent and flexible: with tricks like
git update-index
you can accidentally forget to run it, etc. But once you set up a hook, you never have to worry about it again.
Like the other tricks suggested, hooks don't automatically get propagated between repositories, but you can check them in as regular files and have everyone link them into .git/hooks
.