Delete older git branches

Every few months, I find myself finding the command to delete all my old branches. To the future me,

for k in $(git branch | sed /\*/d); do
  if [ -z "$(git log -1 --since='1 week ago' -s $k)" ]; then
    git branch -D $k
  fi
done