Skip to content

Instantly share code, notes, and snippets.

@jbutz
Last active February 7, 2018 15:13
Show Gist options
  • Save jbutz/42f9dc4ae36707d5844566facd9982b3 to your computer and use it in GitHub Desktop.
Save jbutz/42f9dc4ae36707d5844566facd9982b3 to your computer and use it in GitHub Desktop.
Cleanup old git branches
#!/bin/bash
git checkout master
git pull
git fetch --prune
BRANCHES=`git branch --merged | grep -v master`
IFS=$'\n'
for i in $BRANCHES; do
git branch -d `echo $i | xargs`
done
unset IFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment