Skip to content

Instantly share code, notes, and snippets.

@WanLinLin
Created July 20, 2022 08:06
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 WanLinLin/54052e2b890adc9348b75c48c8483c99 to your computer and use it in GitHub Desktop.
Save WanLinLin/54052e2b890adc9348b75c48c8483c99 to your computer and use it in GitHub Desktop.
Prune local branches that is pruned remotely
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