Jordi Enric

Frontend Software Engineer at Supabase based in Mallorca. You can find me on Twitter and GitHub.

September 16, 2025

Delete local branches older than 1 week

Delete local branches older than 1 week
git branch --sort=committerdate \
  | grep -v "^\*" \
  | while read branch; do
      if [ "$(git log -1 --since='1 week ago' --format=%H $branch)" = "" ]; then
        echo "$branch"
      fi
    done