Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list branches that contain another branch in git

Tags:

git

branch

Can someone explain/provide an example of how to list branches that contains another branch in git?

can I use the contain attribute?

like image 973
Jiraiya Avatar asked Jan 28 '23 10:01

Jiraiya


2 Answers

A branch name is just a fancy pointer to a given commit (in other words, it's a commitish), so you can look for branches that contain it with the --contains option:

$ git branch --contains my_branch

And if you want to check remote branches as well, you can add the -r flag:

$ git branch -r --contains my_branch
like image 89
Mureinik Avatar answered Feb 05 '23 16:02

Mureinik


Sounds like you want to know about git branch --contains whatever-branch. Use -r if you want to check remote branches as well.

like image 27
eftshift0 Avatar answered Feb 05 '23 16:02

eftshift0