Skip to content

Instantly share code, notes, and snippets.

@khanlou
Last active July 7, 2021 08:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khanlou/cd4a28c3474e730213b1207e306a18fe to your computer and use it in GitHub Desktop.
Save khanlou/cd4a28c3474e730213b1207e306a18fe to your computer and use it in GitHub Desktop.
Clean up all merged branches

To clean up git, run:

git remote prune origin; git branch --merged | grep -v '^* master$' | grep -v '^  master$' | xargs git branch -d

If it doesn't like that because it thinks the repo is not there, change the remote from http://github.com to http://khanlou@github.com

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