AlicizaX/Client/Packages/commit.bat
2025-03-11 21:03:30 +08:00

49 lines
1.1 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@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 FinishedPlease Input Any key to Close...
pause >nul