Skip to content

Instantly share code, notes, and snippets.

View mattkaye's full-sized avatar

Matt Kaye mattkaye

  • The Durst Organization
  • New York, NY
View GitHub Profile
@mattkaye
mattkaye / Prune Local Git Branches
Created August 14, 2023 16:15
Prune all git branches not on remote
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done