Skip to content

Instantly share code, notes, and snippets.

@architjn
Created March 5, 2019 06:42
Show Gist options
  • Save architjn/9bf6a2b49092006971e5f5364b82b761 to your computer and use it in GitHub Desktop.
Save architjn/9bf6a2b49092006971e5f5364b82b761 to your computer and use it in GitHub Desktop.
git delete local branches
[alias]
# Delete all local branches but master and the current one, only if they are fully merged with master.
br-delete-useless = "!f(){\
git branch | grep -v "master" | grep -v ^* | xargs git branch -d;\
}; f"
# Delete all local branches but master and the current one.
br-delete-useless-force = "!f(){\
git branch | grep -v "master" | grep -v ^* | xargs git branch -D;\
}; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment