Skip to content

Instantly share code, notes, and snippets.

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 mattscilipoti/bd357b2413b1d0213afe95be5c4dc2a6 to your computer and use it in GitHub Desktop.
Save mattscilipoti/bd357b2413b1d0213afe95be5c4dc2a6 to your computer and use it in GitHub Desktop.
git: clean up local branches that have been deleted remotely
# 1. saves possible branches to file, opens in editor
# 2. remove branches you don't want to delete from the list and save.
git fetch --prune && git branch --no-color --merged | egrep -v "(^\*|master)" > /tmp/merged-branches && vi /tmp/merged-branches && xargs git branch -d < /tmp/merged-branches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment