DEV Community

Discussion on: Remove all your local git branches but keep main

Collapse
 
jeremyf profile image
Jeremy Friesen

I wrote local-branches-with-missing-remote which helps me keep my local branches tidy.

I run local-branches-with-missing-remote | xargs git branch -D to remove all local branches that had remote branches, but those remote branches are gone.

So, when I merge my PR and Github deletes the branch, I can run the above command and keep my branch list nice and tidy.

Collapse
 
po0q profile image
pO0q 🦄

Pretty cool script!