Skip to content

Instantly share code, notes, and snippets.

@awright18
Last active May 12, 2022 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awright18/9636e02573a74bc263075996a2d888c5 to your computer and use it in GitHub Desktop.
Save awright18/9636e02573a74bc263075996a2d888c5 to your computer and use it in GitHub Desktop.
Clean up local Git Branches
function CleanLocalGitRepo
{
git checkout master; git remote update origin --prune; git branch -vv |
Select-String -Pattern ": gone]" |
% { $_.toString().Trim().Split(" ")[0]} |
% {git branch -d $_ }
}
Set-Alias Get-GitClean CleanLocalGitRepo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment