How can I make git ignore future revisions to a file?
What you are searching for is git update-index --assume-unchanged default_values.txt
.
See the docs for more details: http://www.kernel.org/pub/software/scm/git/docs/git-update-index.html
The approach I've generally seen is to create a file with a different name, eg: default_values_template.txt and put default_values.txt in your .gitignore. Instruct people to copy default_values_template.txt to default_values.txt in their local workspaces and make changes as needed.
As many others have mentioned, a good modern solution is:
git update-index --skip-worktree default_values.txt
That will ignore changes to that file, both local and upstream, until you decide to allow them again with:
git update-index --no-skip-worktree default_values.txt
You can get a list of files that are marked skipped with:
git ls-files -v . | grep ^S
Note that unlike --skip-worktree
, the --assume-unchanged
status will get lost once an upstream change is pulled.