Skip to content

Instantly share code, notes, and snippets.

@phackwer
Created July 18, 2019 15:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
GIT cleanup
Get a list of branches
for remote in `git branch -r `; do git branch --track $remote; done
Remove merged remote branches
git branch --merged master | grep -v master | cut -d/ -f2- | xargs -n 1 git push --delete origin
Remove merged local branches
git branch --merged master | grep -v master | xargs -n 1 git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment