1

I have a feature branch that has many more commits than the master branch.

I just merged master in the feature branch, and I'm now ready to open a pull request to merge the feature branch into master.

However, before doing so, I want to list all branches that were created from the feature branch that have additional commits to make sure that all my teammates' branches are merged in the feature branch

thanks

Simon Tran
  • 1,461
  • 1
  • 11
  • 28

1 Answers1

0

I found a way:

git branch -v | grep ahead

-v prints all branches in verbose mode. Filter only branches that are ahead using grep

Simon Tran
  • 1,461
  • 1
  • 11
  • 28
  • 2
    What if the branch has `ahead` in its name? – matt Aug 24 '21 at 23:15
  • you can search for `"\[ahead [0-9]+\]"` – wojand Aug 24 '21 at 23:55
  • It will tell you it is ahead by how many commits, so unless you have lots of branches with ahead in their name it can still be useful to quickly show the few branches that might be ahead – Simon Tran Aug 25 '21 at 03:45
  • 2
    @matt Once I really fell into exactly this trap. `git branch -v` prints commit message (1-line subject) and I had 2 branches with the word "ahead" in the subjects. :-D @SimonTran Better use [`git rev-list --left-right --count`](https://stackoverflow.com/a/61035331/7976758) Found in https://stackoverflow.com/search?q=%5Bgit%5D+count+ahead+behind – phd Aug 25 '21 at 06:34