如何以交互方式(直观地)解决SourceTree / git中的冲突 [英] How to interactively (visually) resolve conflicts in SourceTree / git

查看:1390
本文介绍了如何以交互方式(直观地)解决SourceTree / git中的冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的git项目使用(Windows)SourceTree。我可以在命令提示符或Linux终端上执行。



但是,我想知道是否有一种很好的交互式和可视化解决冲突的方法。例如,如果pull检测到冲突,则弹出基于GUI的冲突工具(例如,P4Merge)。这是可能的吗?



我总是在做手动冲突解决,这很痛苦。



例如,来自SourceTree的git pull 消息。

  git  - c diff.mnemonicprefix = false -c core.quotepath = false pull  - 不提交原始大师
从W:\\\\\\\
*分支主程序 - > FETCH_HEAD

更新33c07bf..41e0249

错误:对下列文件的本地更改将被合并覆盖:
foo.cpp
goo。 cpp
goo.hpp
请在进行合并之前提交更改或隐藏它们。
正在中止

错误完成,参见上文。


解决方案

在SourceTree中,点击工具 - >选项。然后在常规选项卡上,确保选中该框以允许SourceTree修改您的Git配置文件。

然后切换到Diff选项卡。在下半部分,使用下拉菜单选择您要用来执行差异和合并的外部程序。我已经安装了 KDiff3 并且喜欢它。完成后,单击确定。



现在,当进行合并时,您可以在Actions-> Resolve Conflicts-> Launch External Merge Tool下进行操作。


I'm using (Windows) SourceTree for my git project. I can do it in either command prompt or Linux terminal.

But, I'm wondering whether there is a nice way to interactively and visually resolve conflicts. For example, if pull detects conflicts, popping up a GUI-based conflict tool (e.g., P4Merge). Is it possible?

I am always doing manual conflict resolving, which is just painful.

This is, for example, a git pull message, from SourceTree.

git -c diff.mnemonicprefix=false -c core.quotepath=false pull --no-commit origin master
From W:\repo\
 * branch            master     -> FETCH_HEAD   

Updating 33c07bf..41e0249

error: Your local changes to the following files would be overwritten by merge:
    foo.cpp
    goo.cpp
    goo.hpp
Please, commit your changes or stash them before you can merge.
Aborting    

Completed with errors, see above.

解决方案

From SourceTree, click on Tools->Options. Then on the "General" tab, make sure to check the box to allow SourceTree to modify your Git config files.

Then switch to the "Diff" tab. On the lower half, use the drop down to select the external program you want to use to do the diffs and merging. I've installed KDiff3 and like it well enough. When you're done, click OK.

Now when there is a merge, you can go under Actions->Resolve Conflicts->Launch External Merge Tool.

这篇关于如何以交互方式(直观地)解决SourceTree / git中的冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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