Pruning Stale Branches

Andrew
Nov 27, 2020
Photo by Amanda Mocci on Unsplash

Just a quick post on stale branches on this Black Friday. Like old docker images, Git branches that are no longer needed inevitably starts to accumulate as a by-product of everyday development.

To remove these local branches, I use the following commands:

> git remote prune origin
> git branch -vv | grep "origin/.*: gone]" | awk '{print $1}' | xargs git branch -D

And if you need to remove old docker images, check out my post on that here.

--

--