@echo off chcp 65001 >nul setlocal echo ================================ echo Git 只提交新增文件 echo ================================ echo. echo [1/3] 检查新增文件... git status --short echo. echo [2/3] 添加新增文件... for /f "delims=" %%i in ('git ls-files --others --exclude-standard') do ( git add "%%i" ) echo. echo [3/3] 提交并推送... git diff --cached --quiet if %errorlevel%==0 ( echo 没有新的文件需要提交。 goto :end ) git commit -m "add new files" if errorlevel 1 ( echo 提交失败! goto :end ) git push if errorlevel 1 ( echo 推送失败! goto :end ) echo. echo 推送完成! :end pause