AlicizaX/Client/Packages/commit.bat
2025-04-28 19:45:45 +08:00

49 lines
1.1 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
:: 参数处理:使用/pull参数先拉取更新
set DO_PULL=0
if /i "%~1"=="/pull" set DO_PULL=1
:: 遍历当前目录下的所有子目录
for /d %%i in (*) do (
pushd "%%i"
if exist ".git" (
echo.
echo [Process Git Library] %%i
:: 拉取更新(如果启用)
if !DO_PULL! equ 1 (
echo Pull New Changed...
git pull
if errorlevel 1 (
echo [Error] pull failed %%i
popd
goto :next_folder
)
)
:: 提交更改
git add .
git commit -m "modify"
if errorlevel 1 (
echo [inffo] NoChange or commit failed for %%i
) else (
echo Commit Change to Remote ...
git push
if errorlevel 1 (
echo [Error] Push Failed %%i
)
)
) else (
echo.
echo [Skip] %%i Not Git Library
)
:next_folder
popd
)
:: 主动等待用户关闭
echo.
echo Commit Finished Please Input Any key to Close...
pause >nul