Reputation: 3276
I want to know all the branches that containing specific commit hash, is there a nice git or bash way to do so in one command [or one liner]?
--o--a--o--o--o <-- master
\
b--o <-- br2
\
c <-- br1
For this example a exist in all three branches and b exists in br2 and br1. I wish to find command like that:
find_commit <commit-hash>=b
output:
br2
br1
Upvotes: 0
Views: 42
Reputation: 30156
it can be done with
git branch --contains commit-hash
If you want to set a bash alias, you can do this:
alias blahblah='git branch --contains $1'
Then you could say:
blahblah commit-id
And if you like it and you want to keep it, you can set it in your profile file (that's a bash topic, not directly git related).
Upvotes: 2