-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgit-commit.bat
More file actions
56 lines (47 loc) · 1007 Bytes
/
Copy pathgit-commit.bat
File metadata and controls
56 lines (47 loc) · 1007 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
44
45
46
47
48
49
50
51
52
53
54
55
56
@echo off
echo ========================================
echo Git Commit Helper
echo ========================================
echo.
REM Check if Git is initialized
if not exist .git (
echo Initializing Git repository...
git init
echo.
)
REM Show current status
echo Current Git Status:
echo ----------------------------------------
git status
echo.
REM Ask for commit message
set /p commit_msg="Enter commit message: "
if "%commit_msg%"=="" (
echo Error: Commit message cannot be empty!
pause
exit /b 1
)
REM Add all changes
echo.
echo Adding all changes...
git add .
REM Show what will be committed
echo.
echo Files to be committed:
git status --short
REM Confirm
echo.
set /p confirm="Commit these changes? (y/n): "
if /i "%confirm%"=="y" (
git commit -m "%commit_msg%"
echo.
echo ✅ Changes committed successfully!
echo.
echo To push to remote, run: git push origin master
) else (
echo.
echo ❌ Commit cancelled.
git reset
)
echo.
pause