Skip to content

Instantly share code, notes, and snippets.

@nickcheng
Last active August 23, 2018 02:11
Show Gist options
  • Save nickcheng/478f45c8c76570807674938c1ce5f104 to your computer and use it in GitHub Desktop.
Save nickcheng/478f45c8c76570807674938c1ce5f104 to your computer and use it in GitHub Desktop.
[Remove merged branches locally] except current branch, master branch and develop branch #git
# In CLI
git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | grep -v "staging" | xargs -n 1 git branch -d
# As a shell alias
alias gbpurge='git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | grep -v "staging" | xargs -n 1 git branch -d'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment