Skip to content

Instantly share code, notes, and snippets.

@jeffreyschultz
Last active November 20, 2018 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffreyschultz/48e0352c3c668408f63de8314a1f8198 to your computer and use it in GitHub Desktop.
Save jeffreyschultz/48e0352c3c668408f63de8314a1f8198 to your computer and use it in GitHub Desktop.
Prunes git branches that have been merged
#!/usr/bin/env bash
git branch --merged | egrep -v "(^\*|master|green|blue)" | xargs git branch -d
@jeffreyschultz
Copy link
Author

jeffreyschultz commented Nov 19, 2018

git fetch -p upstream && git branch -r --merged upstream/master | grep -Ev '(master|green|blue)' | grep "upstream/" | cut -d "/" -f 2- | xargs -n 20 git push --delete upstream

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