Skip to content

Instantly share code, notes, and snippets.

@l15n

l15n/Local Branches

Forked from schacon/gist:942899
Last active Apr 22, 2020
Embed
What would you like to do?
Delete all remote branches on your fork `mine` which have already been merged into upstream `origin/master`
$ git branch --merged master |
grep -v '*' |
grep -v master |
xargs -L1 |
xargs git branch -d
$ git branch -r --merged origin/master |
grep mine |
grep -v '>' |
grep -v master |
xargs -L1 |
xargs git branch -r -d
$ git branch -r --merged origin/master |
grep mine |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push mine --delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.