Nathan Long

#129: Dead Branches and Butter Running


Hey friends,

Last week had Pi Day, a mathematical excuse to enjoy the most noble of desserts. Hope you had a little pie in your week (or in your future)!


Things I Wrote ✍️

If you run git branch in your repos, how many dead branches pop up? Branches that have long since been merged into main but are just … hanging around. Languishing on your hard drive.

Fortunately there’s a very easy way to tidy up with this one-line script as a little bit of Git arboriculture:

git fetch -p && git branch --format '%(refname:short) %(upstream:track)' | awk '$2=="[gone]" {print $1}' | xargs -r git branch -D

And because I firmly beleive you should never paste things into your terminal that you don’t understand, you can head on over to my recent post for a breakdown explanation of what’s going on in there.

Happy pruning!


Interesting Web Bits 🍿

Web Stuff:

Other Stuff:

Weird, Watch, and Play: