(En) Git - remove old branches in local repo

Posted on January 31, 2023 by lk
Tags: git

Git 101 - Remove old branches in local repo

git for-each-ref \
    --sort=committerdate \
    --format=' %(authordate:relative)%09%(refname:short)' refs/heads \
    | grep -E "year|month" \
    | awk '{print $NF}' \
    | xargs -I$ git branch -D $

Key commands:

Ref