Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
cleanup merged branches

cleanup the merged branches

git branch -r --merged | 
grep origin | 
grep -v '>' | 
grep -v master | 
xargs -L1 | 
cut -d"/" -f2- | 
xargs git push origin --delete

prune the branches which have been removed in origin: git fetch --prune origin

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.