I have a file with database settings in my project which I have set to some defaults. The file is tracked by Git
and checked in. Since this file will be edited with different values various developer machines, is there a way I can tell Git
to ignore new changes to this file?
I tried adding the file to the .gitignore
file, but since the file is tracked it isn't ignored. This is alright and good in other situations, but I am wondering if there is something I can do here?
Best Answer
One may use
git update-index --skip-worktree FILE
for this purpose.It is similar to
--assume-unchanged
but, unlike--assume-unchanged
, is not just an unpredictable performance trick.To cancel
--skip-worktree
effects and unset the flag use--no-skip-worktree
.Downsides
git pull
. (more details)