git 有没有办法在 SourceTree 的两个分支上获得视觉差异?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30177189/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:11:57  来源:igfitidea点击:

Is there a way to get a visual diff on two branches in SourceTree?

gitgit-branchatlassian-sourcetree

提问by Snowcrash

Does Sourcetree offer a way to visualize differences between gitbranches?

Sourcetree 是否提供了一种可视化git分支之间差异的方法?

I'm looking for:

我在找:

  • names of files that have changed
  • diffs between these files
  • 已更改的文件名
  • 这些文件之间的差异

回答by Anton Glukhov

Use ?(OSX) or CTRL(Windows and Linux) and choose any two commits you like in log view. It does not matter what branch the commits belong to.

使用?(OSX) 或CTRL(Windows 和 Linux)并在日志视图中选择您喜欢的任意两个提交。提交属于哪个分支并不重要。

As a result you will see something like...

结果你会看到类似...

Displaying all changes between f03a18bf0370c62bb5fb5c6350589ad8def13aea and 4a4b176b852e7c8e83fffe94ea263042c59f0548

显示 f03a18bf0370c62bb5fb5c6350589ad8def13aea 和 4a4b176b852e7c8e83fffe94ea263042c59f0548 之间的所有变化

...down below.

...在下面。

回答by Gan

Another way to do this is to right-click on a branch and select the "Diff against current" context menu command (currentrefers to the branch you are currently working on). This will give you the diff between the head commits of the two branches.

另一种方法是右键单击一个分支并选择“Diff against current”上下文菜单命令(当前是指您当前正在处理的分支)。这将为您提供两个分支的头部提交之间的差异。

Source: https://answers.atlassian.com/questions/167126/sourcetree-diff-against-current-behavior#

来源:https: //answers.atlassian.com/questions/167126/sourcetree-diff-against-current-behavior#

Screenshot (based on Sourcetree v1.9.5):

截图(基于 Sourcetree v1.9.5):

enter image description here

在此处输入图片说明

After choosing "Diff against Current" from the context menu, you should see a message to the effect of:

从上下文菜单中选择“Diff against Current”后,您应该会看到以下效果的消息:

Displaying all changes between {commit_hash} and working copy

显示 {commit_hash} 和工作副本之间的所有更改

After choosing to "Diff against Current" you should see a list of files that have changed, beneath the message "Displaying all changes between {commit_hash} and working copy"

选择“Diff against Current”后,您应该会在“Displaying all changes between {commit_hash} and working copy”消息下方看到已更改的文件列表

回答by Taran

You can also do this by ctrl + clicking the two branchescommits you want to diff.

您也可以通过 ctrl + 单击要区分的两个分支提交来执行此操作。

回答by lsc05

You can also use an External Diff tool. For example I am using Beyond Compare. After you set it as an external diff tool in sourcetree, you select both files you want to compare using CTRL and after that you press CTRL+D. As a result, Beyond Compare will be launched with both files ready to be compared.

您还可以使用外部差异工具。例如,我正在使用 Beyond Compare。在 sourcetree 中将其设置为外部差异工具后,使用 CTRL 选择要比较的两个文件,然后按 CTRL+D。因此,Beyond Compare 将启动并准备好比较两个文件。