Skip to content

Instantly share code, notes, and snippets.

@penchef
penchef / delete_stale_branches.sh
Created February 12, 2023 02:07
Delete stale branches
#!/usr/local/bin/bash
# source: https://stackoverflow.com/a/51374983
git for-each-ref --sort=committerdate refs/ --format='%(committerdate:raw) %(refname:short)' | \
awk "\$1 < $(date -d "-100 day" "+%s") {print(\$3)}" | \
xargs git branch -D