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)`.
142
142
* [ Add object notes] ( #add-object-notes )
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
+ * [ Find common ancestor of two branches] ( #find-common-ancestor-of-two-branches )
145
146
146
147
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
147
148
<!-- @doxie.inject end toc -->
@@ -960,5 +961,10 @@ git log --show-notes='*'
960
961
git --git-dir=< source-dir> /.git format-patch -k -1 --stdout < SHA1> | git am -3 -k
961
962
```
962
963
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
+
963
969
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
964
970
<!-- @doxie.inject end -->
Original file line number Diff line number Diff line change 414
414
}, {
415
415
"title" : " Apply commit from another repository" ,
416
416
"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"
417
420
}]
You can’t perform that action at this time.
0 commit comments