Bash script for pruning stale local Git branches

planted on in: bash and git.

I often forget to delete my local feature branches after they have been merged upstream and for a while used a plugin for the IntelliJ IDE's. However since that plugin is out of date I went looking for a bash script and found this snippet by someone called Henry:

#!/usr/bin/env bash

for branch in $(git branch -v | grep "gone" | awk '{print $1}')
git branch -d $branch
— Henry | link
Page History

This page was first added to the repository on February 24, 2023 in commit b1bb8d43 and has since been amended twice. View the source on GitHub.

  1. refactor(#304): move files into src folder
  2. chore: add tags
  3. feat(#149): initial adding of some test resources