Knowledge Observatory Obsidian notes, RSS insights, and lightweight AI summaries.
2026年2月25日 未分类

2.1.1 使用 .bat 文件进行自动化的 push

在和项目根目录下新建 auto-push.bat 文件,具体指令可随要求修改

@echo off
cd /d %~dp0

echo ===== Git Auto Push =====

git add .

git diff --cached --quiet
if %errorlevel%==0 (
    echo No changes detected.
    timeout /t 3 >nul
    exit
)

for /f "tokens=1-4 delims=/ " %%i in ("%date%") do set mydate=%%i-%%j-%%k
set mytime=%time:~0,8%

git commit -m "Auto update %mydate% %mytime%"
git push origin main

echo.
echo Push successful.
timeout /t 3 >nul
exit