1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 15:18:01 +00:00
Files
til/git/clean-out-all-local-branches.md
2015-03-31 20:11:00 -05:00

20 lines
616 B
Markdown

# Clean Out All Local Branches
Sometimes a project can get to a point where there are so many local
branches that deleting them one by one is too tedious. This one-liner can
help:
```
$ git branch --merged master | grep -v master | xargs git branch -d
```
This won't delete branches that are unmerged which saves you from doing
something stupid, but can be annoying if you know what you are doing. If you
are sure you want to wipe everything, just use `-D` like so:
```
$ git branch --merged master | grep -v master | xargs git branch -D
```
[source](https://twitter.com/steveklabnik/status/583055065868447744)