Answers for "how to remove branches from local git"

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
2

how to delete branch locally

$ git branch -d <local-branch>
Posted by: Guest on December-04-2020
0

How to Delete Local/Remote Git Branches

$ git branch -a

# *master
# b1
# remote/origin/master
# remote/origin/b1

$ git push origin --delete b1
# [...]
# - [deleted] b1
Posted by: Guest on August-21-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 "how to remove branches from local git"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language