Skip to content

Instantly share code, notes, and snippets.

@ceronman
Created June 19, 2012 20:13
Show Gist options
  • Select an option

  • Save ceronman/2956271 to your computer and use it in GitHub Desktop.

Select an option

Save ceronman/2956271 to your computer and use it in GitHub Desktop.
gitcleanbranches.sh
#!/bin/bash
set -x
# update master first
git checkout master
git pull upstream master
git push origin master
for branch in `git branch --merged | grep -v '*' | tr -d ' '`
do
git branch -d $branch
git push origin :$branch
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment