added git management bat file
This commit is contained in:
47
Source/git_management.bat
Normal file
47
Source/git_management.bat
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user