Skip to content

Instantly share code, notes, and snippets.

@graysky
Forked from sml/prune-branches-except.sh
Created May 15, 2009 14:57
Show Gist options
  • Save graysky/112242 to your computer and use it in GitHub Desktop.
Save graysky/112242 to your computer and use it in GitHub Desktop.
#!/bin/sh
git remote prune origin
branch_list=$(git branch -r | grep -v HEAD | grep -v master | sed s:origin/::)
until [ -z "$1" ]
do
branch_list=$(echo "$branch_list" | grep -v $1)
shift
done
for branch in $branch_list
do
git push origin :heads/${branch}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment