Bash script for pruning stale local Git branches
~117 words, about a 1 min read
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}')
do
git branch -d $branch
done