Last active
May 21, 2022 21:49
-
-
Save chiefmikey/994667b145e63de8ae73b2e0f8709d3a to your computer and use it in GitHub Desktop.
Git delete n oldest remote branches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete 10 oldest branches | |
git fetch --prune && \ | |
git branch -r --sort=committerdate | head -n 10 | sed 's/ origin\///' | xargs git push origin --delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment