Added convenience shell scripts

This commit is contained in:
raccoon
2026-03-02 12:06:35 +05:00
parent c9eec43b74
commit cd4cd13b54
6 changed files with 165 additions and 0 deletions

42
repo-reset.cmd Normal file
View File

@@ -0,0 +1,42 @@
@ECHO OFF
TITLE Reset Unity Project repo
SETLOCAL
CD "%~dp0"
git rev-parse --is-inside-work-tree >NUL || GOTO die
FOR /F "delims=" %%x IN ('git rev-parse --abbrev-ref "@{u}" 2^>NUL') DO SET "upstream=%%x"
IF NOT DEFINED upstream (
ECHO *** ERROR: No upstream is configured for current branch
GOTO die
)
git fetch --all || GOTO die
ECHO.
ECHO Going to reset current branch to: %upstream%
ECHO.
ECHO *** WARNING: These local commits will be lost:
git log "%upstream%..HEAD" --oneline
ECHO.
ECHO *** WARNING: These local files will be reset:
git diff "HEAD..%upstream%" --name-only
ECHO.
CHOICE /M "Execute"
IF %ERRORLEVEL% NEQ 1 (
ECHO Aborting reset...
) ELSE (
git reset --hard "%upstream%" || GOTO die
ECHO Done.
)
:end
PAUSE
EXIT /B 0
:die
PAUSE
EXIT /B %ERRORLEVEL%