这是我的情景,我认为这很常见:
master
上的文件A。fork master
进入feature
git diff master...
但是显示来自git diff
的相同差异,它不会显示从主人到现在的变化。
示例内容和差异
$ git checkout master
$ cat a
line 1
line 2
$ git checkout feature
$ cat a
line 1-1
line 2-2
line 3
line 4
$ edit a #< from now on a is not indexed, it is locally edited
$ cat a
line 1
line 2
line 3
$ git diff
--- a
- line 1-1
- line 1-2
+ line 1
+ line 2
line 3
- line 4
$ git diff master...
--- a
- line 1-1
- line 1-2
+ line 1
+ line 2
line 3
- line 4
我想得到的差异是:
$ git diff ???
--- a
line 1
line 2
+ line 3
答案 0 :(得分:1)
只是做:
git diff master
没有“..”。
来自:http://git-scm.com/docs/git-diff
git diff [--options] <commit> [--] [<path>…]
此表单用于查看工作树中的更改 相对于命名的
<commit>
。您可以使用HEAD将其与之进行比较 最新提交,或分支名称与的提示进行比较 不同分支。