Last Updated: August 15, 2019
· robincurry

git branch-cleanup

Do you find yourself staring at a mess when you type git branch. Cleanup after yourself with ease with this git alias.

git branch-cleanup Will delete any local branches that have already been merged as well as prune remote branches that have been deleted from your origin repo.

Add to .gitconfig

 branch-cleanup = !sh -c 'git branch --merged | grep -v master | xargs git branch -d && git remote prune origin'

1 Response
Add your response

Nice one :) I added this to my cheat sheet. This can be very helpful. (

over 1 year ago ·