-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepository_update.bat
More file actions
67 lines (56 loc) · 1.76 KB
/
repository_update.bat
File metadata and controls
67 lines (56 loc) · 1.76 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
64
65
66
67
@echo off
setlocal enabledelayedexpansion
:: Configurable variables
set "REPO_URL=https://github.com/bugfishtm/bugfish-framework"
set "BRANCH=main"
set "INITIAL_COMMIT_MSG=Initial commit"
:: Cool Output Messages
echo ==============================
echo Welcome to the Bugfish Git Update Script!
echo ==============================
echo This script will help you:
echo 1. Stage all changes
echo 2. Commit with a message of your choice
echo 3. Push the commit to the branch you specify
echo ==============================
:: Confirm before proceeding
set /p "confirm=Are you sure you want to proceed? (y/n): "
if /i not "!confirm!"=="y" (
echo Operation cancelled.
pause
exit /b 1
)
:: Ask for commit message for this update (cannot be empty)
:commitmsg
set /p "commitMsg=Enter your commit message: "
if "!commitMsg!"=="" (
echo Commit message cannot be empty.
goto commitmsg
)
:: Cool message before starting the Git commands
echo ==============================
echo Staging all files...
echo ==============================
:: Stage all files except batch script itself (optional: modify if you want to exclude)
git add .
:: Commit with user input message
echo ==============================
echo Committing with message: "!commitMsg!"
echo ==============================
git commit -m "!commitMsg!"
:: Add remote origin (only if not already added)
git remote get-url origin >nul 2>&1
if errorlevel 1 (
git remote add origin %REPO_URL%
)
:: Push to specified branch
echo ==============================
echo Pushing to branch: %BRANCH%
echo ==============================
git push -u origin %BRANCH%
:: Completion message
echo ==============================
echo All done! Your changes have been pushed to the repository.
echo ==============================
pause
endlocal