-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-sync.bat
More file actions
42 lines (35 loc) · 790 Bytes
/
Copy pathgit-sync.bat
File metadata and controls
42 lines (35 loc) · 790 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
@echo off
echo ========================================
echo Syncing with GitHub
echo ========================================
echo Fetching latest...
git fetch origin
echo.
echo Checking status...
git status
echo.
set /p choice="Pull (p) / Push (u) / Both (b)? "
if /i "%choice%"=="p" goto :pull
if /i "%choice%"=="u" goto :push
if /i "%choice%"=="b" goto :both
goto :end
:both
git reset --hard origin/main
git clean -fd
echo Local synced with GitHub.
:push
set /p msg="Commit message: "
if "%msg%"=="" set msg="Update %date% %time%"
git add .
git commit -m "%msg%"
git push -u origin main
goto :end
:pull
git reset --hard origin/main
git clean -fd
:end
echo.
echo ========================================
echo Sync complete!
echo ========================================
pause