From bfdf5be5d64e4c145de4f66f0385dc4721939979 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Nov 2025 12:45:06 +0200 Subject: [PATCH] added git management bat file --- Source/git_management.bat | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Source/git_management.bat diff --git a/Source/git_management.bat b/Source/git_management.bat new file mode 100644 index 0000000..94bf34d --- /dev/null +++ b/Source/git_management.bat @@ -0,0 +1,47 @@ +@echo off +REM --------------------------------------------- +REM Safe Switchboard External Command: Git Pull +REM Discards local changes, pulls latest from current branch +REM Safe to keep inside the Git repo +REM --------------------------------------------- + +REM Change this to your project repo path (can be inside repo) +set REPO_PATH=D:\Projects\DEV_TheStudio_Plugin + +REM Name of this batch file +set BATCH_NAME=%~nx0 + +echo ------------------------------------------------ +echo [%COMPUTERNAME%] Starting safe Git pull on %REPO_PATH% +echo ------------------------------------------------ + +REM Navigate to the repo +cd /d "%REPO_PATH%" + +REM Ensure Git is installed +where git >nul 2>&1 +IF %ERRORLEVEL% NEQ 0 ( + echo ERROR: Git is not installed or not in PATH + exit /b 1 +) + +REM Get current branch +for /f "tokens=*" %%i in ('git rev-parse --abbrev-ref HEAD') do set CURRENT_BRANCH=%%i +echo Current branch: %CURRENT_BRANCH% + +REM Discard any local changes (staged and unstaged) +git reset --hard + +REM Clean untracked files and directories, excluding this batch file +git clean -fdX -e "%BATCH_NAME%" + +REM Pull latest changes from origin for current branch +git pull origin %CURRENT_BRANCH% + +REM Show status +git status + +echo ------------------------------------------------ +echo [%COMPUTERNAME%] Git pull complete +echo ------------------------------------------------ +pause