如果git status
不为空,我试图退出批处理脚本:
setlocal EnableDelayedExpansion
FOR /F "tokens=*" %%g IN ('git status -s') do (SET GIT_STATUS=%%g)
(SET LF=^
%=this line is empty=%
)
IF "!GIT_STATUS!" NEQ "!LF!" ECHO (
echo "ERROR: Git status is not empty: %GIT_STATUS%"
goto END
)
:END
即使git状态是干净的,它也会打印错误消息。我可以尝试什么?