Created
January 11, 2024 13:05
-
-
Save GustavoAmerico/acf5e42ae8797e6794b7a13c91d97532 to your computer and use it in GitHub Desktop.
Esse script é responsável por executar um merge automático de uma branch base para todas as outras branchs. Em caso de conflitos o script faz rollback e pula a branch conflitante
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
param([Parameter(Mandatory=$true)][String]$branchNamePattern, $remoteName = 'origin', $branchBase='master') | |
$branchsToUpdate=(git branch --all|%{$_.ToString().Replace("remotes/$remoteName/",'').Trim()} | Select-String -Pattern $branchNamePattern); | |
$branchsToUpdate |%{git checkout $_; git merge "$remoteName/$branchBase"; if(-not $?){git merge --abort; git reset --hard}else{ git push } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment