如何进行提交或永久本地更改 [英] How to make a commit, or a change permanently local

查看:100
本文介绍了如何进行提交或永久本地更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我的项目更改了一个文件(配置文件)。我希望这种更改只能是本地的,因此会从准备提交的更改列表中消失。



有没有简单的方法可以做到这一点?
请注意,配置文件会定期存储在存储库中。

解决方案

一种方法是:



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

另外:

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

(第二个将抵抗 git reset



但我更喜欢使用一个内容过滤器驱动程序用于这种本地配置:版本化一个模板文件,并使用值(存储在其他地方)生成实际文件。


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.

解决方案

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.

这篇关于如何进行提交或永久本地更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆