-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_steps.bat
More file actions
55 lines (47 loc) · 1.09 KB
/
Copy pathgit_steps.bat
File metadata and controls
55 lines (47 loc) · 1.09 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
@echo off
setlocal
echo Git: update main
echo ==================
echo.
echo [1/5] Refreshing README.md version block from .env (VERSION, VERSION_date, VERSION_mess)...
call npm run update-readme
if errorlevel 1 goto :error
echo.
echo [2/5] Switching to main branch...
git checkout main
if errorlevel 1 goto :error
echo.
echo [3/5] Pulling latest main from origin...
git pull origin main
if errorlevel 1 goto :error
echo.
echo [4/5] Staging changes...
git add -A
if errorlevel 1 goto :error
git diff --cached --quiet && (
echo Nothing to commit - working tree clean. Skipping commit and push.
goto :end
)
git status --short
echo.
set "MSG="
set /p "MSG=Commit message (leave blank to cancel): "
if not defined MSG (
echo No message entered - nothing committed. Exiting.
goto :end
)
git commit -m "%MSG%"
if errorlevel 1 goto :error
echo.
echo [5/5] Pushing main to origin...
git push origin main
if errorlevel 1 goto :error
echo.
echo Done - main updated and pushed.
goto :end
:error
echo.
echo *** A step failed (errorlevel %errorlevel%). Stopped - nothing further was run. ***
:end
endlocal
pause