Reputation: 1400
I want to display a list of all branches with Git 2.5.5 that have been merged into the current one except the current one itself (it might also be interesting to list all branches merged into specified branch X
except X
but my use case at hand only requires this for the current branch).
git branch --merged
lists all merged branches including the current one, i. e. it will always list at least one branch. I can use git branch --merged | sed -ne 's/^ //p;'
to process the output of git branch --merged
to DWIM.
Is there an existing porcelain command that lists all merged branches except the current one? Are there other ways to get this list?
Upvotes: 2
Views: 457
Reputation: 1236
You can use the command git branch --merged
to get the details of the branches merged into the current branch(including the current branch). You can ignore the current branch (checkedout branch) by using grep or egrep to ignore the current branch (below is the command). I have tried this and it displayed all the branches merged into the current branch (excluding the current branch)
git branch --merged | egrep -v "(^\*|<current branch>)"
Upvotes: 1