Skip to content

Instantly share code, notes, and snippets.

@sylvainraye
Created September 10, 2013 08:52
Show Gist options
  • Save sylvainraye/6506734 to your computer and use it in GitHub Desktop.
Save sylvainraye/6506734 to your computer and use it in GitHub Desktop.
Delete all branches of a Git repo (locally and remotely) except the master branch
for t in `git branch | grep -v "master"`
do
git branch -D $t
git push --delete origin $t
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment