Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Clean the branches in git repository according to the remote
# Go to the directory
cd "$1"
# Delete branches, but keep develop, master and the current branch
git remote prune origin
git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | xargs -n 1 git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment