Last active
April 4, 2022 14:26
-
-
Save andrx/6ee89c9a69deb1b0151848140a061eed to your computer and use it in GitHub Desktop.
git. Remove all remote branches except 'master' and 'develop' on powershell without checking them out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch -a | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'} | %{$_.Replace("remotes/","")} | %{git branch -d -r $_ ; if($?){ git push origin $_.Replace("origin/",":refs/heads/")}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment