Skip to content

Instantly share code, notes, and snippets.

@ajsaraujo
Created September 9, 2022 12:27
Show Gist options
  • Save ajsaraujo/2c526a8de46aecbbd7fac26ea9333b53 to your computer and use it in GitHub Desktop.
Save ajsaraujo/2c526a8de46aecbbd7fac26ea9333b53 to your computer and use it in GitHub Desktop.
Deleting old git branches
# Delete old local branches
git for-each-ref --format '%(refname:short)' refs/heads | ForEach-Object {git branch $_ -d}
# Remove references to old remote branches
git remote prune origin