git branch -a --contains <commit>
List all branches that contain commit <commit>, including remote branches.
The -a
flag (abbreviation of --all
), ensures both local branches in remote-tracking branches are listed.
remote-tracking branches are pointers to last known state of remote branches, so they may be outdated. For better results, you should use git fetch
to sync up with the remote.
You can see all the branches that don't contain a specific commit by using the --no-contains
instead of the --contains
one.