Last active
August 3, 2023 20:17
-
-
Save GustavoAmerico/994146e0c6a88ddbca2ff1def2a6ff54 to your computer and use it in GitHub Desktop.
[danger] Esse comando é utilizado para apagar multiplos branchs que utilizam o mesmo padrão de nomenclatura
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
/* | |
ATENÇÃO: Esse comando não verifica se as alterações forma mescladas com a branch principal!! O branch vai ser apagado | |
*/ | |
param([Parameter(Mandatory=$true)][String]$branchNamePattern, $remoteName = 'origin') | |
git branch --all --merged | Select-String -Pattern $branchNamePattern | %{$_.ToString().Replace("remotes/$remoteName/",'').Trim()} | %{ git push origin :$_ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adicionar o parametro --merged para filtrar apenas os branch mesclados com o branch atual (faça git checkout antes).