1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 17:02:09 +02:00
tldr/pages/common/git-merge-base.md
Richard Mörbitz e01871f1c9
git-merge-base: add page (#9382)
Co-authored-by: Axel Navarro <navarroaxel@gmail.com>
2022-12-11 02:12:03 +01:00

439 B

git merge-base

Find a common ancestor of two commits. More information: https://git-scm.com/docs/git-merge-base.

  • Print the best common ancestor of two commits:

git merge-base {{commit_1}} {{commit_2}}

  • Output all best common ancestors of two commits:

git merge-base --all {{commit_1}} {{commit_2}}

  • Check if a commit is an ancestor of a specific commit:

git merge-base --is-ancestor {{ancestor_commit}} {{commit}}