Answers for "delete a local branch from git"


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

git delete local branch

$ 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).
Posted by: Guest on May-15-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language