:books: Today I Learned

How to check which Git branches contain a commit

tooling Git git cli

The --contains option of the git branch command will list branches which contain the specified commit, in the same format as when running git branch or git branch --list:

$> git branch --contains aa82193
* some-branch

This output indicates that both the some-branch branch and the master branch contain commit aa82193 (and that some-branch is the current branch).

There is an inverse option, the --no-contains option, which will only list branches that don’t contain the specified commit.