Alvin Bakker Alvin Bakker - 1 year ago 119
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?

Answer Source

Pipe it to findstr then check the error level

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

IF %errorlevel%==0 GOTO:EOF

echo Continuing ....
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download