ssm_zg
Last Updated: November 02, 2017
·
1.621K
· EnriqueVidal
8b3482cd83cd8170d9bbbb711062dcc3

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
Say Thanks
Respond

2 Responses
Add your response

3434
372909bbd2c8ec9f54a401c368789335

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
8b3482cd83cd8170d9bbbb711062dcc3

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

over 1 year ago ·
Filed Under