Skip to content

Commit b869dd5

Browse files
committed
Merge branch 'routinet-routinet-contrib-2'
* routinet-routinet-contrib-2: Find common ancestor of two branches
2 parents 50bb413 + 9ae2058 commit b869dd5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`.
143143
* [Show all the git-notes](#show-all-the-git-notes)
144144
* [Apply commit from another repository](#apply-commit-from-another-repository)
145145
* [Specific fetch reference](#specific-fetch-reference)
146+
* [Find common ancestor of two branches](#find-common-ancestor-of-two-branches)
146147

147148
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
148149
<!-- @doxie.inject end toc -->
@@ -973,5 +974,10 @@ git --git-dir=<source-dir>/.git format-patch -k -1 --stdout <SHA1> | git am -3 -
973974
git fetch origin master:refs/remotes/origin/mymaster
974975
```
975976

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+
976982
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
977983
<!-- @doxie.inject end -->

tips.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,4 +418,7 @@
418418
},{
419419
"title": "Specific fetch reference",
420420
"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"
421424
}]

0 commit comments

Comments
 (0)