Skip to content

Instantly share code, notes, and snippets.

@mikeybeck
Last active April 16, 2021 05:43
Show Gist options
  • Select an option

  • Save mikeybeck/8bf751208551f31263c88e5765f9012a to your computer and use it in GitHub Desktop.

Select an option

Save mikeybeck/8bf751208551f31263c88e5765f9012a to your computer and use it in GitHub Desktop.
Deletes my production-merged remote git branches for a given date period (2020-08) in an extremely inefficient manner
git for-each-ref --format=' %(authorname) %09 %(committerdate:short) %09 %(refname)' --sort=committerdate --sort=authorname --merged production | grep "refs/remotes/origin/" | sed 's/refs\/remotes\/origin\///g' | grep Mike | grep mikeybeck | grep 2020-08 | awk '{ print $4 }' | while read x; do echo "deleting $x"; git push origin --delete $x; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment