-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-push.bat
More file actions
63 lines (53 loc) · 1.4 KB
/
Copy pathgit-push.bat
File metadata and controls
63 lines (53 loc) · 1.4 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
56
57
58
59
60
61
62
63
@echo off
chcp 65001 >nul
setlocal
echo ========================================
echo Push dsh-memory-plugin to GitHub
echo ========================================
echo.
cd /d "%~dp0"
if errorlevel 1 (
echo [ERROR] Failed to enter the repository directory.
exit /b 1
)
git rev-parse --show-toplevel >nul 2>&1
if errorlevel 1 (
echo [ERROR] This script must be run from a Git repository.
exit /b 1
)
git remote get-url origin >nul 2>&1
if errorlevel 1 (
echo [ERROR] Git remote 'origin' is not configured.
echo Configure it with: git remote add origin ^<repository-url^>
exit /b 1
)
echo Step 1: Staging changes...
git add -A
if errorlevel 1 (
echo [ERROR] Failed to stage files.
exit /b 1
)
git diff --cached --quiet
if not errorlevel 1 (
echo [INFO] No changes to commit.
exit /b 0
)
set "COMMIT_MESSAGE=%~1"
if not defined COMMIT_MESSAGE set "COMMIT_MESSAGE=chore: update dsh-memory-plugin"
echo Step 2: Creating commit...
git commit -m "%COMMIT_MESSAGE%"
if errorlevel 1 (
echo [ERROR] Failed to create commit.
exit /b 1
)
echo Step 3: Pushing current branch...
git push origin HEAD
if errorlevel 1 (
echo [ERROR] Push failed. Check the remote URL, credentials, and network connection.
exit /b 1
)
echo.
echo ========================================
echo [SUCCESS] Code pushed to GitHub!
echo ========================================
endlocal