Sleavely
Sleavely

Reputation: 1683

Find branches stemming from commit

I want to be able to see which branches are based on a certain commit. Given a repository:

A--------B-----C-----------D (master)
 `-E (B1)      |`--F (B2)   `-H (B4)
                `--G (B3)

How do I see branches stemming from commit C? I need a list of at least B2 and B3, but if master is also included in the output that's okay. I would prefer if B4 isn't included.

Upvotes: 0

Views: 58

Answers (2)

wwl1991
wwl1991

Reputation: 126

If you want see which branch or tag refer to you can

git log -1 <commit-id> --simplify-by-decoration

--simplify-by-decoration
       Commits that are referred by some branch or tag are selected.

If you want see which branch contain you can

git branch (-a) --contains <commit-id>

Upvotes: 0

&#212;rel
&#212;rel

Reputation: 7622

Simply use this:

git branch --contains <commit-id>

Upvotes: 1

Related Questions