Git合并冲突(UU):如何解决冲突而不向下一次提交添加文件? [英] Git Merge Conflict (UU): How do I resolve conflict without adding file to next commit?

查看:350
本文介绍了Git合并冲突(UU):如何解决冲突而不向下一次提交添加文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何解决一个UU(合并冲突)而无需将该文件添加到下一个提交中。

例如,我只是樱桃选择了一个提交给另一个分支,有合并问题。我解决了合并问题,并希望UU readme.txt更改为M readme.txt,但不会将其添加到我所做的下一个提交中。



谢谢

解决方案

我不知道你在'11使用的是什么版本的git,但是现在我在1.7.7.4。 p>

在我看来,添加标记已解决的冲突确实会将文件添加到舞台上;所以我的做法是:

  git add< filename> 
git reset HEAD< filename>

您也可以创建一个自定义git命令来为您执行此操作。我在我的路径的目录中创建了一个名为 git-resolve (无扩展名)的可执行文件(我喜欢在〜/中放置这样的东西。 bin )并把它放在它:

  git add $ @ 
git reset HEAD $ @

然后从命令行解决冲突后,我可以这样做:

  $ git resolve< filename> 


How do I resolve a UU (merge conflict) without adding that file to the next commit.

For example, I just cherry picked a commit to another branch and there were merge issues. I solved the merge issue and want UU readme.txt changed to M readme.txt but it not be added to the next commit I make.

Thanks

解决方案

I don't know what version of git you were using back in '11, but right now I'm on 1.7.7.4.

It appears to me that doing an add to mark the conflict resolved does add the file to the stage; so my approach is:

git add <filename>
git reset HEAD <filename>

You could also create a custom git command that does this for you. I created an executable file named git-resolve (no extension) in a directory on my path (I like to put stuff like this in ~/.bin) and put this in it:

git add $@
git reset HEAD $@

Then from the command line, after I've resolved my conflicts, I can do:

$ git resolve <filename>

这篇关于Git合并冲突(UU):如何解决冲突而不向下一次提交添加文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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