41 lines
889 B
Batchfile
41 lines
889 B
Batchfile
@echo off
|
|
REM Script untuk pull frontend di server production (Windows)
|
|
REM Usage: pull.bat
|
|
|
|
echo Pulling Retribusi Frontend...
|
|
cd /d "%~dp0"
|
|
|
|
REM Cek apakah ini git repository
|
|
if not exist ".git" (
|
|
echo Error: Bukan git repository
|
|
exit /b 1
|
|
)
|
|
|
|
REM Cek branch saat ini
|
|
for /f "tokens=2" %%b in ('git branch --show-current 2^>nul') do set CURRENT_BRANCH=%%b
|
|
echo Current branch: %CURRENT_BRANCH%
|
|
|
|
REM Stash perubahan lokal jika ada
|
|
echo Stashing local changes (if any)...
|
|
git stash
|
|
|
|
REM Pull dari origin main
|
|
echo Pulling from origin/main...
|
|
git pull origin main
|
|
|
|
REM Jika ada stash, coba pop (optional)
|
|
git stash list >nul 2>&1
|
|
if %errorlevel% equ 0 (
|
|
echo Restoring stashed changes...
|
|
git stash pop
|
|
if %errorlevel% neq 0 (
|
|
echo Warning: Ada conflict saat restore stash, silakan resolve manual
|
|
)
|
|
)
|
|
|
|
echo Pull selesai!
|
|
echo.
|
|
echo Status:
|
|
git status --short
|
|
|