使用方法
./joinGit.bat running
此操作会将running分支依次合并到developer test stage和prod上;并推送
@echo off
setlocal enabledelayedexpansion
IF "%~1"=="" (
echo Please provide a branch to merge from.
exit /b
)
for /f "tokens=*" %%a in ('git branch --show-current') do set currentBranch=%%a
echo The current branch is '%currentBranch%'.
if "%currentBranch%" NEQ "%~1" (
echo The current branch is not '%~1'.
exit /b
)
set branches=developer test stage prod
for %%b in (%branches%) do (
git checkout %%b
if errorlevel 1 exit /b
git merge %~1
if errorlevel 1 exit /b
git push origin %%b
if errorlevel 1 exit /b
echo Merged and pushed to %%b.
)
git checkout %~1