At one point I thought that git fetch origin --prune
deleted local branches that were no longer present on the server. Somehow this is not my experience at the
This is how I do it with Powershell.
PS> git branch --v | ? { $_ -match "\[gone\]" } | % { -split $_ | select -First 1 } | % { git branch -D $_ }
You can then create an alias like:
PS> Function func_gitprune { git branch --v | ? { $_ -match "\[gone\]" } | % { -split $_ | select -First 1 } | % { git branch -D $_ } }
PS> Set-Alias -Name gitprune -Value func_gitprune
and execute it every time you need by running
PS> gitprune