Skip to content

Instantly share code, notes, and snippets.

@johnallers
Created June 8, 2020 21:08
Show Gist options
  • Save johnallers/3349b00d29cb75fb5d50c2f9f77e35db to your computer and use it in GitHub Desktop.
Save johnallers/3349b00d29cb75fb5d50c2f9f77e35db to your computer and use it in GitHub Desktop.
PowerShell functions for finding and removing local branches that have been merged
function Find-GitLocalMerged {
Write-Host "git branch --merged | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'}}"
& git branch --merged | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'}
}
function Clean-GitLocalMerged {
Write-Host "git branch --merged | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'} | %{git branch -d $_}"
& git branch --merged | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'} | %{git branch -d $_}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment