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 kgiszewski/8eb0c9c6e7c86710d7a859186ef5bef9 to your computer and use it in GitHub Desktop.
Save kgiszewski/8eb0c9c6e7c86710d7a859186ef5bef9 to your computer and use it in GitHub Desktop.
[alias]
cleanup = !git branch --merged master | grep -v '^[ *]*master$' | xargs -r git branch -d
@kgiszewski
Copy link
Author

kgiszewski commented Jun 19, 2018

Edit your global config file by running: git config --global --edit.

Run as git cleanup.

Original source: https://stackoverflow.com/questions/13064613/how-to-prune-local-tracking-branches-that-do-not-exist-on-remote-anymore/16906759#16906759

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