mirror of https://github.com/namibia/tips.git
Find common ancestor of two branches
This commit is contained in:
parent
59de6a8b80
commit
d2bf9e8c63
|
@ -142,6 +142,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`.
|
||||||
* [Add object notes](#add-object-notes)
|
* [Add object notes](#add-object-notes)
|
||||||
* [Show all the git-notes](#show-all-the-git-notes)
|
* [Show all the git-notes](#show-all-the-git-notes)
|
||||||
* [Apply commit from another repository](#apply-commit-from-another-repository)
|
* [Apply commit from another repository](#apply-commit-from-another-repository)
|
||||||
|
* [Find common ancestor of two branches](#find-common-ancestor-of-two-branches)
|
||||||
|
|
||||||
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
||||||
<!-- @doxie.inject end toc -->
|
<!-- @doxie.inject end toc -->
|
||||||
|
@ -960,5 +961,10 @@ git log --show-notes='*'
|
||||||
git --git-dir=<source-dir>/.git format-patch -k -1 --stdout <SHA1> | git am -3 -k
|
git --git-dir=<source-dir>/.git format-patch -k -1 --stdout <SHA1> | git am -3 -k
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 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
|
||||||
|
```
|
||||||
|
|
||||||
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
||||||
<!-- @doxie.inject end -->
|
<!-- @doxie.inject end -->
|
||||||
|
|
|
@ -414,4 +414,7 @@
|
||||||
}, {
|
}, {
|
||||||
"title": "Apply commit from another repository",
|
"title": "Apply commit from another repository",
|
||||||
"tip": "git --git-dir=<source-dir>/.git format-patch -k -1 --stdout <SHA1> | git am -3 -k"
|
"tip": "git --git-dir=<source-dir>/.git format-patch -k -1 --stdout <SHA1> | git am -3 -k"
|
||||||
|
}, {
|
||||||
|
"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"
|
||||||
}]
|
}]
|
||||||
|
|
Loading…
Reference in New Issue