Last Updated: November 02, 2017
· EnriqueVidal

Remove remote merged branches

You can remove all remote branches that have been merged to master in one line.

git branch -r --merged master | ack -v master | sed -e 's/\// :/' | xargs -n2 git push

2 Responses
Add your response


The sed expression should probably not be global, it breaks for branch names with slashes in them.

sed -e 's/\// :/'

over 1 year ago ·

Oh nice catch, I'll edit the protip removing the global bit, thanks.

over 1 year ago ·