git-merge-base:tldr:8553f
git-merge-base: Output all best common ancestors of two commits.
$ git merge-base --all ${commit_1} ${commit_2}
try on your machine
The command git merge-base --all ${commit_1} ${commit_2}
is used to find the common ancestor of two commits in a Git repository.
Here's what each part of the command means:
git merge-base
is the main command. It is used to find the best common ancestor between the two specified commits.--all
option is used to output all the common ancestors instead of just the best one.${commit_1}
and${commit_2}
are placeholders for the commit identifiers that you want to find the common ancestor between. These can be branch names, commit hashes, or any other valid commit identifier.
When you run this command, Git examines the commit history of the given commits and finds the best (or all) common ancestor(s) between them. The command then outputs the commit hash(es) of the common ancestor(s).
This command is particularly useful when you want to see where two branches initially diverged from each other, or when you want to find a common base for merging changes from one branch into another.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.