Skip to content

Instantly share code, notes, and snippets.

@hrwgc
Created October 22, 2013 14:49
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 hrwgc/7102083 to your computer and use it in GitHub Desktop.
Save hrwgc/7102083 to your computer and use it in GitHub Desktop.
remove all non master branches from git repo
function clean_git_branches(){
git checkout master;
BRANCHES=`git branch | grep -Ev '^\s{0,}\*{0,}\s{0,}master$'`
git branch -D ${BRANCHES[@]}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment