Skip to content

Instantly share code, notes, and snippets.

@peteraritchie
Created January 23, 2025 14:12
Show Gist options
  • Save peteraritchie/c131d25e65f79be9e2e4a3bfe2fc3020 to your computer and use it in GitHub Desktop.
Save peteraritchie/c131d25e65f79be9e2e4a3bfe2fc3020 to your computer and use it in GitHub Desktop.
Delete git branches merged to main

Delete git branches merged to main

A simple powershell script to clean up local branches that have been merged to main:

git branch --merged main | Foreach-object { if($_.SubString(0,1) -ne '*'){ git branch -d $_.SubString(2);} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment