1
什麼是一個好的,簡明的,易於記憶的方法來請求「分支X引入的更改,因爲它與分支Y不同」?我經常發現自己這樣做:由分支X引入的更改,因爲它與分支Y分開
$ git diff --stat $(git merge-base master HEAD)..
但似乎有一定是對於不涉及的bash-主義的簡寫。
什麼是一個好的,簡明的,易於記憶的方法來請求「分支X引入的更改,因爲它與分支Y不同」?我經常發現自己這樣做:由分支X引入的更改,因爲它與分支Y分開
$ git diff --stat $(git merge-base master HEAD)..
但似乎有一定是對於不涉及的bash-主義的簡寫。
三點修訂符號X...Y
自動計算提交X
和Y
的合併基礎。通常它意味着(如gitrevisions
筆記)「從任一轉而不是兩轉都可達到的提交集」。
對於git diff
,然而,meaning is altered:
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.
同時,在git diff
,平原..
是也改變的裝置,以及與指定的..
的任一側上的每個修訂分別。
所以:
git diff --stat $(git merge-base master HEAD)..
相同:
git diff --stat $(git merge-base master HEAD)..HEAD
這是一樣的:
git diff --stat $(git merge-base master HEAD) HEAD
這是一樣的:
git diff --stat master...HEAD
這是一樣的:
git diff --stat master...
這是你最短的短手。