@echo off call environment.bat passive setlocal enabledelayedexpansion ECHO. pushd "%~dp0\webui" set "current_branch=" for /f "delims=" %%C in ('git rev-parse --abbrev-ref HEAD 2^>nul') do set "current_branch=%%C" if not defined current_branch ( echo Current branch: [no branch information available] ) else if /i "!current_branch!"=="HEAD" ( echo Current branch: [detached HEAD] ) else ( echo Current branch: !current_branch! ) ECHO Trying to update to latest version ... git pull 2>NUL if %ERRORLEVEL% == 0 goto :done ECHO git clone returned errorlevel %ERRORLEVEL%, initiating hard reset ... git reset --hard git pull :done popd pause