3

We have a feature branch "feature" that has many descendant branches that are not merged in. I would like to find all of these branches so that we can make decisions to merge them in or not. We have a fairly large git repository and using git branch feature --no-merge shows us hundreds of branches that are not descendants of "feature".

I know that git does not track parent branches so this seems to be a difficult task and I was wondering if anyone has an easy way to find these.

Alex Spence
  • 1,478
  • 3
  • 17
  • 22
  • 1
    possible duplicate of [git finding unmerged branches](http://stackoverflow.com/questions/12276001/git-finding-unmerged-branches) – Jeff Bowman Jan 08 '14 at 17:38
  • 1
    I am looking to find unmerged branches that are descendants of a specific branch. The above question does not cover my situation. – Alex Spence Jan 08 '14 at 18:44
  • It does if you use `--contains`. Sorry for not mentioning that in the above comment, but in any case torek mentioned it below. – Jeff Bowman Jan 08 '14 at 22:15

1 Answers1

3

Get the complete list of branches with git branch --no-merged and filter against git branch --contains.

(I don't know if this works, but it's possible that git branch --no-merged X --contains X will do the trick without even requiring running comm or equivalent.)

torek
  • 448,244
  • 59
  • 642
  • 775
  • It does seem to "do the trick"; thanks for this. I like `git branch -a --no-merged A --contains B` to find all the new "branchlets" introduced since `B` that I might want to bring into `A`. – Woody Zenfell III Sep 09 '14 at 16:18