在应用补丁时有什么办法来解决冲突? [英] When applying a patch is there any way to resolve conflicts?

查看:374
本文介绍了在应用补丁时有什么办法来解决冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在窗户上。

由于各种原因,我们有不同的svn分支的多个git实例。

很多时候我想修复存储库A中的问题,生成一个补丁,并将其应用于存储库B.这可以正常工作,除非有冲突。

重新绑定时,我只需右键单击该文件夹并使用tortioseGit并选择解析选项。这带来了一个很好的gui让我通过我的冲突工作。



有没有办法通过拒绝的补丁块来完成这项工作?



这是我目前创建/应用补丁

  git format-patch master --stdout> c:\\\patch\\file.patch 
git apply --reject --ignore-space-change --ignore-whitespace c:\\patch\\file.patch


解决方案

要生成您的修补程序,请执行以下操作:

  git format-patch --stdout first_commit ^ .. last_commit> changes.patch 

现在,当您准备好应用补丁时:

  git am -3< changes.patch 

-3 会执行如果存在冲突,则进行三方合并。此时,如果您想要转到gui或仅使用vim手动合并文件(标准<<<<<>,则可以执行 git mergetool ;<<<<< code>< code> |||||| >>>> ;>> 解决冲突)。


I am on windows.

For various reasons we have multiple git instances of different svn branches.

Many times I want to fix an issue in repository A, generate a patch, and apply it to repository B. This works fine except if there are conflicts.

When rebasing I just right click the folder and use tortioseGit and select the resolve option. This brings up a nice gui to let me work through my conflicts.

Is there any way to accomplish this with rejected patch chunks?

Here is my current approach to creating/applying the patches

git format-patch master --stdout > c:\\patch\\file.patch
git apply --reject --ignore-space-change --ignore-whitespace c:\\patch\\file.patch

解决方案

To generate your patch do the following:

git format-patch --stdout first_commit^..last_commit > changes.patch

Now when you are ready to apply the patches:

git am -3 < changes.patch

the -3 will do a three-way merge if there are conflicts. At this point you can do a git mergetool if you want to go to a gui or just manually merge the files using vim (the standard <<<<<<, ||||||, >>>>>> conflict resolution).

这篇关于在应用补丁时有什么办法来解决冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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