// delete branch locally
git branch -d localBranchName
//delete local branch that is unmerged
git branch -D localBranchName
// delete branch remotely
git push origin --delete remoteBranchName
git branch -d <branch_name>
git branch -d test
# Delete remote branch
git push origin -d remote_branch_name
# Delete local branch
git branch -d local_branch_name
# Force delete if getting merge error
git branch -D local_branch_name
$ git branch -d branch_name
$ git branch -D branch_name
$ git branch -d <local-branch>
// delete branch locally
git branch -d branchName
//delete unmerged local branch
git branch -D branchName
// delete branch remotely
git push origin --delete branchName
git delete
$ git branch -D Test_Branch
git branch -d feature/git
# HowTo delete multiple git branches on MAC / Linux / Unix environments
# git branch | grep "<RegXpattern>" | xargs git branch -D
# here's an example to delete multiple branches that starts with "branch"
git branch | grep "branch*" | xargs git branch -D
[alias]
gone = ! "git fetch -p && git for-each-ref --format '%(refname:short) %(upstream:track)' | awk '$2 == "[gone]" {print $1}' | xargs -r git branch -D"
$ git for-each-ref --format '%(refname:short) %(upstream:track)' |
awk '$2 == "[gone]" {print $1}' |
xargs -r git branch -D
Deleted branch fix-typo (was 7b57d4f).
Deleted branch grammar-fix (was 01257bd).