I have a git repository with multiple branches.
How can I know which branches are already merged into the master branch?
I have a git repository with multiple branches.
How can I know which branches are already merged into the master branch?
You can use the git merge-base
command to find the latest common commit between the two branches. If that commit is the same as your branch head, then the branch has been completely merged.
Note that git branch -d
does this sort of thing already because it will refuse to delete a branch that hasn't already been completely merged.
If found myself the answer:
git branch --merged
lists the branches that are already merged
git branch --no-merged
lists the branches that have not been merged