@echo off rem git-sync (Windows): push the current branch, then release my LFS locks on fully pushed files. rem Mirrors the "Push & release my locks" button in the Unity Git Locks window. setlocal enabledelayedexpansion for /f "delims=" %%r in ('git rev-parse --show-toplevel') do cd /d "%%r" for /f "delims=" %%b in ('git rev-parse --abbrev-ref HEAD') do set BRANCH=%%b echo Pushing !BRANCH!... git push origin HEAD if errorlevel 1 ( echo Push failed, no lock released. exit /b 1 ) for /f "delims=" %%m in ('git config --get wayLocks.username 2^>nul') do set ME=%%m echo Releasing locks on fully pushed files... for /f "tokens=1,2 delims= " %%p in ('git lfs locks 2^>nul') do ( set "P=%%p" set "O=%%q" if defined ME if not "!O!"=="!ME!" ( rem skip locks owned by others ) else ( git status --porcelain -- "!P!" > "%TEMP%\gitlocks_status.txt" for %%z in ("%TEMP%\gitlocks_status.txt") do if %%~zz==0 ( git lfs unlock "!P!" >nul 2>&1 && echo released !P! ) ) ) del "%TEMP%\gitlocks_status.txt" 2>nul echo Done. endlocal