首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >合并git中的配置文件

合并git中的配置文件
EN

Stack Overflow用户
提问于 2015-05-28 08:59:49
回答 2查看 59关注 0票数 2

我有一个包含配置文件的github存储库。

我克隆存储库来创建一个实例并编辑配置文件。

当我需要提取最新版本时,我会保存配置文件,然后在拉动之后弹出它们。

但是,有时对存储库配置文件进行更改。这意味着本地配置文件需要合并到存储库版本中,但不应该将该合并文件推回存储库。

我该怎么做?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-05-28 09:06:20

一旦完成合并(但尚未开始),您可以尝试使用git update-index

代码语言:javascript
复制
git update-index --assume-unchanged -- yourConfigFile

从索引中看不到任何更改。

(后来的git update-index --no-assume-unchanged -- yourConfigFile)

票数 3
EN

Stack Overflow用户

发布于 2015-05-28 09:06:53

弹出后,应该有一个自动合并。

问题是,当git完成自动合并时,它可能已经将文件标记为“需要提交”。实际上,你要问的是如何“重置”这个标记?,解决办法是:

代码语言:javascript
复制
git reset --mixed HEAD

从手册页:

代码语言:javascript
复制
   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是默认模式,因此可以取消。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30501804

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档