gpt4 book ai didi

git - 如何交互式(可视化)解决 SourceTree/git 中的冲突

转载 作者:IT王子 更新时间:2023-10-29 01:21:58 30 4
gpt4 key购买 nike

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

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

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

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

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.

最佳答案

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

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

现在当有 merge 时,您可以在 Actions->Resolve Conflicts->Launch External Merge Tool 下进行。

关于git - 如何交互式(可视化)解决 SourceTree/git 中的冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16800280/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com