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 @@ -142,6 +142,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`.
142142* [ Add object notes] ( #add-object-notes )
143143* [ Show all the git-notes] ( #show-all-the-git-notes )
144144* [ Apply commit from another repository] ( #apply-commit-from-another-repository )
145+ * [ Find common ancestor of two branches] ( #find-common-ancestor-of-two-branches )
145146
146147<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
147148<!-- @doxie.inject end toc -->
@@ -960,5 +961,10 @@ git log --show-notes='*'
960961git --git-dir=< source-dir> /.git format-patch -k -1 --stdout < SHA1> | git am -3 -k
961962```
962963
964+ ## Find common ancestor of two branches
965+ ``` sh
966+ diff -u <( git rev-list --first-parent BranchA) <( git rev-list --first-parent BranchB) | sed -ne ' s/^ //p' | head -1
967+ ```
968+
963969<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
964970<!-- @doxie.inject end -->
Original file line number Diff line number Diff line change 414414}, {
415415 "title" : " Apply commit from another repository" ,
416416 "tip" : " git --git-dir=<source-dir>/.git format-patch -k -1 --stdout <SHA1> | git am -3 -k"
417+ }, {
418+ "title" : " Find common ancestor of two branches" ,
419+ "tip" : " diff -u <(git rev-list --first-parent BranchA) <(git rev-list --first-parent BranchB) | sed -ne 's/^ //p' | head -1"
417420}]
You can’t perform that action at this time.
0 commit comments