File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`.
143
143
* [ Show all the git-notes] ( #show-all-the-git-notes )
144
144
* [ Apply commit from another repository] ( #apply-commit-from-another-repository )
145
145
* [ Specific fetch reference] ( #specific-fetch-reference )
146
+ * [ Find common ancestor of two branches] ( #find-common-ancestor-of-two-branches )
146
147
147
148
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
148
149
<!-- @doxie.inject end toc -->
@@ -973,5 +974,10 @@ git --git-dir=<source-dir>/.git format-patch -k -1 --stdout <SHA1> | git am -3 -
973
974
git fetch origin master:refs/remotes/origin/mymaster
974
975
```
975
976
977
+ ## Find common ancestor of two branches
978
+ ``` sh
979
+ diff -u <( git rev-list --first-parent BranchA) <( git rev-list --first-parent BranchB) | sed -ne ' s/^ //p' | head -1
980
+ ```
981
+
976
982
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
977
983
<!-- @doxie.inject end -->
Original file line number Diff line number Diff line change 418
418
},{
419
419
"title" : " Specific fetch reference" ,
420
420
"tip" : " git fetch origin master:refs/remotes/origin/mymaster"
421
+ }, {
422
+ "title" : " Find common ancestor of two branches" ,
423
+ "tip" : " diff -u <(git rev-list --first-parent BranchA) <(git rev-list --first-parent BranchB) | sed -ne 's/^ //p' | head -1"
421
424
}]
You can’t perform that action at this time.
0 commit comments