1
0
mirror of https://github.com/namibia/tips.git synced 2024-11-13 16:56:30 +00:00

Find common ancestor of two branches.

This commit is contained in:
Hemanth.HM 2016-10-05 15:51:17 +05:30
commit 9ae20580d5
2 changed files with 9 additions and 0 deletions

View File

@ -143,6 +143,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`.
* [Show all the git-notes](#show-all-the-git-notes)
* [Apply commit from another repository](#apply-commit-from-another-repository)
* [Specific fetch reference](#specific-fetch-reference)
* [Find common ancestor of two branches](#find-common-ancestor-of-two-branches)
<!-- Dont remove or change the comment below that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
<!-- @doxie.inject end toc -->
@ -973,5 +974,10 @@ git --git-dir=<source-dir>/.git format-patch -k -1 --stdout <SHA1> | git am -3 -
git fetch origin master:refs/remotes/origin/mymaster
```
## Find common ancestor of two branches
```sh
diff -u <(git rev-list --first-parent BranchA) <(git rev-list --first-parent BranchB) | sed -ne 's/^ //p' | head -1
```
<!-- Dont remove or change the comment below that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
<!-- @doxie.inject end -->

View File

@ -418,4 +418,7 @@
},{
"title": "Specific fetch reference",
"tip": "git fetch origin master:refs/remotes/origin/mymaster"
}, {
"title": "Find common ancestor of two branches",
"tip": "diff -u <(git rev-list --first-parent BranchA) <(git rev-list --first-parent BranchB) | sed -ne 's/^ //p' | head -1"
}]