2017-03-04 67 views
0

比方說你有一個Git庫包括兩個的Git分支:計算不同分支上文件的差異。 GitHub的服務器VS GIT(CLI)

  1. 分支一個(可以說@提交abc111)
  2. 分支兩(可以說@提交xyz222)

在存儲庫中,我可以驗證一個單獨的文件是在兩個位置相同的通過從終端中執行的git diff命令:

這可以用git命令行通過以下語法來完成:

git diff abc111 xyz222 -- foo.txt 

什麼,我有問題,當我嘗試使用GitHub的服務器的(比較或PR),這兩個分支比較(在各自提交-ID位置)DIFF功能。

我可以去以下網址:

http://<our-v2.9.0-github-appliance-url>/<repo>/abc111...xyz222 

...並在文件上的顯示差異foo.txt

任何想法,爲什麼GitHub的服務器的比較/ PR功能顯示「差異」該文件何時不應該有?

感謝您的協助/指示。

回答

0

我相信這是因爲<commit>..<commit>(這是什麼git diff <commit> <commit> is)和<commit>...<commit>是不同的。

git-diff docs ...

git diff [--options] <commit> <commit> [--] [<path>...] 
     This is to view the changes between two arbitrary <commit>. 

    git diff [--options] <commit>..<commit> [--] [<path>...] 
     This is synonymous to the previous form. If <commit> on one side is omitted, it 
     will have the same effect as using HEAD instead. 

    git diff [--options] <commit>...<commit> [--] [<path>...] 
     This form is to view the changes on the branch containing and up to the second 
     <commit>, starting at a common ancestor of both <commit>. "git diff A...B" is 
     equivalent to "git diff $(git-merge-base A B) B". You can omit any one of 
     <commit>, which has the same effect as using HEAD instead. 

你在URL做<commit>..<commit>在命令行上和<commit>...<commit>

+0

盯着我整個時間在URL中的臉!如果我有足夠的聲望,我會贊成。謝謝。 – user1217547