Alvin Bakker Alvin Bakker - 5 months ago 49
Git Question

Catch response in Windows batch file

I am making a small batch file to pull from git. I use the following:

call git pull origin master

But would like the rest of the batch file to stop running when the response of the command is
Already up-to-date.

How do I do that?


Pipe it to findstr then check the error level

git pull | findstr /C:"Already up-to-date"

IF %errorlevel%==0 GOTO:EOF

echo Continuing ....