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

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

问题描述

我正在为我的 git 项目使用 (Windows) SourceTree.我可以在命令提示符或 Linux 终端中执行此操作.

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

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

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.

例如,这是来自 SourceTree 的 git pull 消息.

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:
epo
 * 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.

推荐答案

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

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.

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

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天全站免登陆