:: git-pull-all.bat @ECHO OFF SETLOCAL ENABLEEXTENSIONS SET MYGIT="C:Program FilesGitingit.exe" FOR /D %%X IN (*) DO ( IF EXIST "%%X.git" ( CD /D "%%X" ECHO ===== git pull %%X %MYGIT% checkout test %MYGIT% pull --recurse-submodules=yes --ff-only --all --progress CD /D .. ) ELSE ECHO ..... Skipped %%X ) :bye PAUSE ENDLOCAL
第二种 实现方式
@echo off set dir=%~dp0 set branch=test cd %dir% for /d %%i in (%dir%*) do ( cd %%i git fetch git checkout %branch% git pull origin %branch% cd ../ echo %%i ) pause