使用 Mergetool 比较和编辑 Git 中的分支

发布于 2024-09-11 23:56:51 字数 353 浏览 3 评论 0原文

我有 2 个分支,可以使用 difftool(超越比较)来比较/比较。 但是,用于比较的文件是临时副本,而不是当前分支的实际文件。 这意味着如果我想更改现有文件,我无法通过 difftool 来完成。我需要复制一个分支的文件,检查另一个分支并在实际文件之间使用常规差异。

有没有办法让 difftool 使用当前分支的实际文件(至少在一侧)?

更新和解决方案

我使用的命令是git difftoolbranch1branch2。 无论当前分支如何,这都会比较 2 个分支。

命令 git difftoolbranch 可以根据需要工作,其中一侧作为当前签出的分支。

I have 2 branches that I can compare/diff using my difftool (Beyond Compare).
However, the files used for the diff are temporary copies and not the actual files from the current branch.
This means that if I want to make a change to an existing file, I cannot do it via the difftool. I would need to make a copy of the files of one branch, checkout the other branch and use a regular diff between the actual files.

Is there a way to get the difftool to use the actual files of the current branch (at least on one side)?

UPDATE and SOLUTION:

The command I used was git difftool branch1 branch2.
This diffs 2 branches regardless of the current branch.

The command git difftool branch works as desired, with one "side" as the currently checked-out branch.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

裸钻 2024-09-18 23:56:51

命令 git difftoolbranch 可以根据需要工作,其中一侧作为当前签出的分支。

The command git difftool branch works as desired, with one "side" as the currently checked-out branch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文