Last active
January 17, 2025 16:50
-
-
Save talentedmrjones/796c42749d8059a49413644c19f3fd25 to your computer and use it in GitHub Desktop.
Easily keep your git repo clean by automating pruning and deleting stale branches. Simply add this line to .zshrc (or other shell config)
This file contains 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
# checkout main | |
# pull origin | |
# prune origin | |
# delete local branches that were pruned from origin | |
alias gpmp="git checkout main && git pull && git remote prune origin | grep \"\[pruned\]\" | xargs -I % echo % | sed -e 's/\* \[pruned\] origin\///g' | xargs -I % git branch -D %" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment