tags: #git, #delete
links: [[Git MOC]]
---
```bash
// delete branch locally
git branch -d localBranchName
// forcefully delete a branch
git branch -D localBranchName
// delete branch remotely
git push origin --delete remoteBranchName
```
```
git fetch -p
```
The -p flag means "prune". After fetching, branches which no longer exist on the remote will be deleted
## Delete all branches except master
```bash
git branch | grep -v "master" | xargs git branch -D
```