2022-12-11 01:12:03 +00:00
|
|
|
# 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}}`
|
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
- Print all best common ancestors of two commits:
|
2022-12-11 01:12:03 +00:00
|
|
|
|
|
|
|
`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}}`
|