Answers for "git delete all local branches"

146

delete local branch

// 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
Posted by: Guest on April-07-2020
11

delete all local branches git

$ git branch | grep -v "master" | xargs git branch -D
Posted by: Guest on May-27-2020
1

git delete all branches except master

git branch | grep -v "master" | xargs git branch -D
Posted by: Guest on May-18-2020
0

delete all local branches except current branch

git branch | grep -v "master" | grep -v ^* | xargs git branch -D
Posted by: Guest on June-28-2021
0

how to delete all branches in git except master

$ git branch | grep -v '^*' | xargs git branch -D
Posted by: Guest on June-07-2020
0

git delete all local branches

git for-each-ref --format '%(refname:short)' refs/heads | grep -v master | xargs git branch -D
Posted by: Guest on December-10-2020

Code answers related to "git delete all local branches"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language