How to make a commit, or a change permanently loca

2019-04-14 20:34发布

问题:

I have changed a file (configuration file) for my project. I would like this change to be only local and therefore disappear from the list of changes ready to be committed.

Is there any easy way to do that? Please note that the configuration file is regularly stored in the repository.

回答1:

One way is:

git  update-index --assume-unchanged -- /path/to/file

Another:

git update-index --skip-worktree -- /path/to/file

(the second will resist to a git reset)

But I prefer using a content filter driver for that kind of local config: versioning a template file, and using values (stored elsewhere) to generate the actual file.