Skip to content

Instantly share code, notes, and snippets.

@jijosg
Created May 10, 2024 12:25
Show Gist options
  • Save jijosg/82f045596d22b19851ea00d9c07e134a to your computer and use it in GitHub Desktop.
Save jijosg/82f045596d22b19851ea00d9c07e134a to your computer and use it in GitHub Desktop.
Delete untracked git branches on local
git fetch -p
git for-each-ref --format '%(if:equals=[gone])%(upstream:track)%(then)%(refname:short)%(end)' 'refs/heads/**' | xargs -r git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment