Skip to content

Instantly share code, notes, and snippets.

@dharness
Created December 14, 2023 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dharness/21144563c9820b2cc6d1b19b8729cd6d to your computer and use it in GitHub Desktop.
Save dharness/21144563c9820b2cc6d1b19b8729cd6d to your computer and use it in GitHub Desktop.
Delete git branches more than 2 weeks old
git for-each-ref --sort=-committerdate refs/heads --format='%(committerdate:short) %(refname:short)' | awk '$1 < "'$(date -v-2w +%Y-%m-%d)'" {print $2}' | xargs git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment