Skip to content

Instantly share code, notes, and snippets.

@aarti
Created February 20, 2014 21:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save aarti/9123747 to your computer and use it in GitHub Desktop.
Save aarti/9123747 to your computer and use it in GitHub Desktop.
Delete unused git branches
→ git remote prune origin
→ git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
# Remember to do this from the master branch
# If you run it from a feature branch the master branch gets deleted.
→ git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
Deleted branch master (was 644eb76).
You can recheckout master branch
→ git checkout -b master origin/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment