Skip to content

Instantly share code, notes, and snippets.

@jseed
Last active June 30, 2026 14:06
Show Gist options
  • Select an option

  • Save jseed/5d022570ea52ee09a8f43913214496f1 to your computer and use it in GitHub Desktop.

Select an option

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()})
@kiview

kiview commented Jan 5, 2022

Copy link
Copy Markdown

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

@icodeintx

Copy link
Copy Markdown

Thank You!

@younghoandrewchaa

Copy link
Copy Markdown

Thanks!

@anujpradhaan

Copy link
Copy Markdown

You are a savior!

@data-miner00

Copy link
Copy Markdown

Thank you very much!

@GonzaloRMDT

Copy link
Copy Markdown

Thanks!

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