-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-download.bat
More file actions
43 lines (34 loc) · 870 Bytes
/
github-download.bat
File metadata and controls
43 lines (34 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@echo off
setlocal
cd /d "%~dp0"
for %%I in ("%cd%") do set "REPO_PATH=%%~fI"
where git >nul 2>nul
if errorlevel 1 (
echo [ERROR] Git is not installed or not on PATH.
pause
exit /b 1
)
git config --global --add safe.directory "%REPO_PATH%" >nul 2>nul
git rev-parse --is-inside-work-tree >nul 2>nul
if errorlevel 1 (
echo [ERROR] This folder is not a Git repository.
echo Run github-upload.bat once first, or clone the repo in a fresh folder.
pause
exit /b 1
)
echo [INFO] Fetching latest updates...
git fetch origin || goto :fail
echo [INFO] Switching to main branch...
git checkout main || goto :fail
echo [INFO] Pulling updates (fast-forward only)...
git pull --ff-only origin main || goto :fail
echo.
echo [OK] Download complete. Local branch is up to date.
endlocal
exit /b 0
:fail
echo.
echo [ERROR] Download failed.
pause
endlocal
exit /b 1