Created
July 20, 2022 08:06
-
-
Save WanLinLin/54052e2b890adc9348b75c48c8483c99 to your computer and use it in GitHub Desktop.
Prune local branches that is pruned remotely
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
remote_pruned_branches=$(git remote prune origin | tail -n +3 | sed -e 's| \* \[pruned\] origin/||') | |
echo "remote pruned branches:\n$remote_pruned_branches" | |
echo "\ndeleting branches:" | |
echo $remote_pruned_branches | xargs git branch -D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment