Skip to content

Instantly share code, notes, and snippets.

@shanerk
Last active March 18, 2024 19:25
Show Gist options
  • Save shanerk/65815ca1e95ebb88cfc148f8d5df83fe to your computer and use it in GitHub Desktop.
Save shanerk/65815ca1e95ebb88cfc148f8d5df83fe to your computer and use it in GitHub Desktop.
Cleanup Local Branches which were deleted on the remote
git fetch -p
git for-each-ref --format '%(refname:short) %(upstream:track)' |
awk '$2 == "[gone]" {print $1}' |
xargs git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment