Skip to content

Instantly share code, notes, and snippets.

@arjshiv
Created March 16, 2025 21:23
Show Gist options
  • Save arjshiv/66f5838526f235b0278c18296a054203 to your computer and use it in GitHub Desktop.
Save arjshiv/66f5838526f235b0278c18296a054203 to your computer and use it in GitHub Desktop.
bash snippet to pull main branch and delete any closed or deleted branches from the origin
git checkout master && git pull origin && git remote prune origin && git gc && git branch --v | grep "\[gone\]" | awk '{print $1}' | xargs git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment