ssm_zg
Last Updated: November 02, 2017
·
2.167K
· 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

3434

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

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

over 1 year ago ·
3454

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

over 1 year ago ·