Skip to content

Instantly share code, notes, and snippets.

@MickaelBergem
Last active August 29, 2015 14:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MickaelBergem/1faa654f90ccba0cb927 to your computer and use it in GitHub Desktop.
Save MickaelBergem/1faa654f90ccba0cb927 to your computer and use it in GitHub Desktop.
Remove all local branches that have been merged
# Will remove all merged branches, except the current one.
git remote prune origin && git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
@MickaelBergem
Copy link
Author

To add it as an alias :

git config --global alias.menage '!git remote prune origin && git branch --merged | grep -v "\*" | xargs -n 1 git branch -d'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment