Skip to content

Instantly share code, notes, and snippets.

@lorddev
Created February 16, 2016 19:20
Show Gist options
  • Save lorddev/f3d1ce691fb8e005b099 to your computer and use it in GitHub Desktop.
Save lorddev/f3d1ce691fb8e005b099 to your computer and use it in GitHub Desktop.
PowerShell script for pruning branches already merged
function Prune-Branches
{
git branch --merged | ForEach-Object { $_.Trim() } |
Where-Object {-not ( $_ -Like "*master" )} | Where-Object {-not ( $_ -Like "*develop" )} | ForEach-Object { git branch -d $_.Replace('origin/', '') }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment