How can I identify which branches contain a specific commit?
-
Using
git branch --contains <commit-hash>
:git branch --contains abc123
This shows all local branches containing the commit.
-
To include remote branches as well:
git branch -a --contains abc123
Replace abc123
with your actual commit hash. You can use either the full hash or a shortened version (at least 7 characters).
These commands will list all branches that include the specified commit in their history.