我有一个包含配置文件的github存储库。
我克隆存储库来创建一个实例并编辑配置文件。
当我需要提取最新版本时,我会保存配置文件,然后在拉动之后弹出它们。
但是,有时对存储库配置文件进行更改。这意味着本地配置文件需要合并到存储库版本中,但不应该将该合并文件推回存储库。
我该怎么做?
发布于 2015-05-28 09:06:20
一旦完成合并(但尚未开始),您可以尝试使用git update-index:
git update-index --assume-unchanged -- yourConfigFile从索引中看不到任何更改。
(后来的git update-index --no-assume-unchanged -- yourConfigFile)
发布于 2015-05-28 09:06:53
弹出后,应该有一个自动合并。
问题是,当git完成自动合并时,它可能已经将文件标记为“需要提交”。实际上,你要问的是如何“重置”这个标记?,解决办法是:
git reset --mixed HEAD从手册页:
git reset [<mode>] [<commit>]
This form resets the current branch head to <commit> and possibly updates the index (resetting it to the tree of <commit>) and the working tree depending on <mode>. If <mode> is omitted,
defaults to "--mixed". The <mode> must be one of the following:
[...]
--mixed
Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. This is the default action.如您所见,--mixed是默认模式,因此可以取消。
https://stackoverflow.com/questions/30501804
复制相似问题