当前版本的分支的GitHub比较视图

Avr*_*ril 16 git branch github

有没有办法使用GitHub的"比较视图"来查看两个分支的当前版本之间的差异?(也就是说,要查看相同的差异,如果你这样做了git diff <a-branch> <another-branch>.)

在这里做了一个小例子.有两个分支:"主"和"其他分支".如果我这样做git diff master..other-branch,这就是差异:

diff --git a/README.md b/README.md
index 495cc9f..3d2c3a0 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,3 @@
 Hello there!
+
+This is a commit to the "other-branch" branch.
Run Code Online (Sandbox Code Playgroud)

您可以从该差异中看到"主"分支和"其他分支"分支之间的差异是添加了一个空行和一行文本,并且没有删除.

但是,如果我尝试使用GitHub比较视图(https://github.com/akenney/compare-view-test/compare/other-branchhttps://github.com/akenney/compare-view-test/compare /master...other-branch),它显示了这个差异:

-This is a commit to the master branch.
+Hello there!
+
+This is a commit to the "other-branch" branch.
Run Code Online (Sandbox Code Playgroud)

它将"other-branch"分支与旧版本的"master"分支进行比较,而不是与当前版本进行比较.即使我指定要比较的特定提交(https://github.com/akenney/compare-view-test/compare/8ed0d53...e4470ec),它也会发生同样的事情- 它所显示的差异并不是那些差异两个提交.

nul*_*ken 12

GitHub仅支持三点(...)范围快捷方式规范.

git diff文档:

git diff [--options] .. [ - ] [...]

这与之前的表格同义.如果省略一侧,则其效果与使用HEAD相同.

git diff [--options] ... [ - ] [...]

此表单用于查看包含和最多为第二个的分支上的更改,从两者的共同祖先开始."git diff A ... B"相当于"git diff $(git-merge-base AB)B".您可以省略任何一个,这与使用HEAD具有相同的效果.

  • 好的......所以问题的答案是否定的.那好吧.谢谢.我不知道这就是三点的含义,我不确定GitHub为什么不支持普通的双点类型差异. (3认同)