Skip to content

Instantly share code, notes, and snippets.

@jseed
Last active July 22, 2024 19:30
Show Gist options
  • Save jseed/5d022570ea52ee09a8f43913214496f1 to your computer and use it in GitHub Desktop.
Save jseed/5d022570ea52ee09a8f43913214496f1 to your computer and use it in GitHub Desktop.
PowerShell command to delete all branches except master
git checkout master; git branch -D @(git branch | select-string -NotMatch "master" | Foreach {$_.Line.Trim()})
@nickgayo12
Copy link

Big help, Thanks!

@kiview
Copy link

kiview commented Jan 5, 2022

I knew this had to be out there somewhere, thanks!

@icodeintx
Copy link

Thank You!

@andrewchaa
Copy link

Thanks!

@anujpradhaan
Copy link

You are a savior!

@data-miner00
Copy link

Thank you very much!

@GonzaloRMDT
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment