Answers for "how to delete git branches locally"

167

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
3

delete branch git

// delete branch locally
git branch -D localBranchName

// delete branch remotely
git push
Posted by: Guest on August-12-2020
0

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