Skip to content

Instantly share code, notes, and snippets.

@pragmat1c
Created April 4, 2019 18:31
Show Gist options
  • Save pragmat1c/125cdb06e56a7e8d790f070121d775bf to your computer and use it in GitHub Desktop.
Save pragmat1c/125cdb06e56a7e8d790f070121d775bf to your computer and use it in GitHub Desktop.
Prune local git branches that don't have a remote branch. I use this to clean up the branches I've committed and merged every so often.
#In your .gitconfig
[alias]
prune-branches = !git remote prune origin && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs -r git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment