Ananda Sudarshan
Ananda Sudarshan

Reputation: 485

How to get list of all branches created off a GIT branch (get all sub branches of a branch)

Is there a way to get the list of all branches created off a branch in GIT.

For e.g. If we have say Rel2 branch created off master, and then we have SP1, SP2 and SP3 created from Rel2 Branch.

Is there any command in GIT to get SP1, SP2 and SP3 as output if i give Rel2 as input ?

Upvotes: 5

Views: 4333

Answers (1)

René Link
René Link

Reputation: 51473

Just take a commit you want and do

git branch --contains commitid

in your case you can also do

git branch --contains Rel2

This will list all branches that have the given commit in their history.

To list remote branches do

git branch -r --contains commitid

Upvotes: 6

Related Questions