git gitkraken - 如何比较 2 个分支
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/53234113/
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
gitkraken - How to compare 2 branches
提问by Michalis
Is there any way to compare 2 branches (branch1 and branch2) with gitkraken?
有没有办法将 2 个分支(branch1 和 branch2)与 gitkraken 进行比较?
I want a list of files that have changes
我想要一个有变化的文件列表
回答by Mickael V.
GitKraken, as far as I know after some looking into that matter, doesn't let you compare branches regarding their commits. One way to do what you want though, is to use Soloing; you right-click the first branch you want to compare and choose 'Solo'. Orange circles will appear to the left of the branches names instead of the eye. Then click the faded orange icon next to the second branch you want to solo. Only those branches will be shown in the commit view.
据我所知,GitKraken 在对此事进行了一些调查后,不会让您比较分支的提交。但是,做您想做的一种方法是使用Soloing;您右键单击要比较的第一个分支并选择“Solo”。橙色圆圈将出现在分支名称的左侧而不是眼睛。然后单击您要独奏的第二个分支旁边的褪色橙色图标。只有那些分支会显示在提交视图中。
Then you just select one commit, and click the second while holding Shift. The list of changed files will appear on the right. Clicking on a file will also show you the diff of contents.
然后您只需选择一个提交,然后在按住 的同时单击第二个提交Shift。更改的文件列表将出现在右侧。单击文件还会显示内容的差异。
It's worth mentioning though that you can't set the direction of the diff (source and target branch) ; but this has helped me to find out what's changed between two branches.
值得一提的是,您无法设置差异的方向(源和目标分支);但这帮助我找出了两个分支之间发生了什么变化。
回答by amin saffar
If you want to find out difference between branch A and B First checkout on branch A then click on branch B and select commits it then you can find changes on right panel.
如果您想找出分支 A 和 B 之间的区别,首先在分支 A 上结帐,然后单击分支 B 并选择提交它,然后您可以在右侧面板上找到更改。
and can select multiple commit rows in the graph using Shift Click to show its merged diff
并且可以使用 Shift 单击在图中选择多个提交行以显示其合并的差异
回答by CodeWizard
I want a list of files that have changed
我想要一个已更改的文件列表
git whatchanged
git whatchanged
- You can always use the command line and use the
git whatchanged
command. Full documentation can be found at https://git-scm.com/docs/git-whatchanged. - This command supports many of the
git log
flags so you can use them as well
- 您始终可以使用命令行并使用
git whatchanged
命令。完整文档可以在https://git-scm.com/docs/git-whatchanged找到。 - 此命令支持许多
git log
标志,因此您也可以使用它们
based upon the comment:
根据评论:
let's say that 2 coworkers work at the same bug... and you want to compare the 2 branches.... to find the best solution (real example)
假设 2 个同事在同一个错误上工作……并且您想比较 2 个分支……以找到最佳解决方案(真实示例)
There are few ways to find differences between 2 branches:
有几种方法可以找到 2 个分支之间的差异:
**In case you get empty result swap the branches
**如果你得到空结果交换分支
git diff <branch1>...<branch2>
git diff <branch1> ^<branch2>
git log <branch1>...<branch2>
git whatchanged
git diff <branch1>...<branch2>
git diff <branch1> ^<branch2>
git log <branch1>...<branch2>
git whatchanged