git 找到 2 个远程分支之间的差异

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13981570/
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-10 15:08:19  来源:igfitidea点击:

find difference between 2 remote branches

git

提问by michael

How can I find out what are the differences between 2 remote branches?

如何找出 2 个远程分支之间的区别?

I tried:

我试过:

git diff --name-status remotes/branch-V4.4..remotes/branch-V4.2

But it gives me a list of files which changes. Is there a way I get a list of commits which shows me the difference between 2 branches?

但它给了我一个改变的文件列表。有没有办法让我得到一个提交列表来显示两个分支之间的区别?

Thank you.

谢谢你。

Update:

更新:

Thank you for the answer. I have tried 'git log --graph remotes/branch-V4.4...remotes/branch-V4.2'

谢谢你的回答。我试过'git log --graph remotes/branch-V4.4...remotes/branch-V4.2'

I see

我懂了

* commit ............
|
|
| 
* commit .............
|
|
| 
* commit .............|
|
| 
* commit .............

Why only "|" , a straight line? why it does not show where does the 2 branches begins to diverge?

为什么只有“|” ,一条直线?为什么它没有显示 2 个分支从哪里开始分叉?

Thank you.

谢谢你。

回答by Chronial

What you are looking for is probably something like:

您正在寻找的内容可能类似于:

gitk --left-right remotes/branch-V4.4...remotes/branch-V4.2

or if gitk is not available:

或者如果 gitk 不可用:

git log --oneline --graph --decorate --left-right --boundary --date-order remotes/branch-V4.4...remotes/branch-V4.2

You might also want to try it without the --date-order, but especially in complicated situations, I found that git logproduces more useful graphs with that option.

您可能还想在没有 的--date-order情况下尝试它,但特别是在复杂的情况下,我发现git log使用该选项可以生成更有用的图表。

Every commit in that graph will be either marked with <, >or o- that means that they are part of the left branch, the right branch or a “boundary commit”.

该图中的每个提交都将标有<,>o- 这意味着它们是左分支、右分支或“边界提交”的一部分。

回答by Andrew Marshall

Use git loginstead of git diff:

使用git log代替git diff

git log remotes/branch-V4.4..remotes/branch-V4.2

回答by atreyHazelHispanic

You can simply do.

你可以简单地做。

git diff origin/<remote branch>