Remove all your local git branches but keep master

R

Sometimes after a sprint, all the remaining branches are just taking up space.
Here’s a small snippet to remove all your local branches in one go.

git branch | grep -v "master" | xargs git branch -D 

If you want to keep the current branch use

grep -v ^*

About the author

Imran Pollob

Learn => Practice => Implement => Repeat

Add comment

Categories

Imran Pollob

Learn => Practice => Implement => Repeat

Get in touch