|
| 1 | +@echo off |
| 2 | +:: Cool Output Messages |
| 3 | +echo ============================== |
| 4 | +echo Welcome to the Git Automation Script! |
| 5 | +echo ============================== |
| 6 | +echo This script will help you: |
| 7 | +echo 1. Stage all changes (excluding this .bat file) |
| 8 | +echo 2. Commit with a message of your choice |
| 9 | +echo 3. Push the commit to the branch you specify |
| 10 | +echo ============================== |
| 11 | + |
| 12 | +:: Asking for the branch name |
| 13 | +set /p branch=Enter the branch you want to push to (default is 'main'): |
| 14 | + |
| 15 | +:: Set default branch to 'main' if no input is given |
| 16 | +if "%branch%"=="" set branch=main |
| 17 | + |
| 18 | +:: Asking for the commit message |
| 19 | +set /p commitMsg=Enter your commit message: |
| 20 | + |
| 21 | +:: Cool message before starting the Git commands |
| 22 | +echo ============================== |
| 23 | +echo Staging files (excluding the .bat file)... |
| 24 | +echo ============================== |
| 25 | + |
| 26 | +:: Staging all files except this .bat file |
| 27 | +git add . |
| 28 | + |
| 29 | +:: Cool message before committing |
| 30 | +echo ============================== |
| 31 | +echo Committing with message: "%commitMsg%" |
| 32 | +echo ============================== |
| 33 | + |
| 34 | +:: Committing the changes |
| 35 | +git commit -m "%commitMsg%" |
| 36 | + |
| 37 | +:: Cool message before pushing |
| 38 | +echo ============================== |
| 39 | +echo Pushing to branch: %branch% |
| 40 | +echo ============================== |
| 41 | + |
| 42 | +:: Pushing to the specified branch |
| 43 | +git push -u origin %branch% |
| 44 | + |
| 45 | +:: Completion message |
| 46 | +echo ============================== |
| 47 | +echo All done! Your changes have been pushed to the repository. |
| 48 | +echo ============================== |
| 49 | +pause |
0 commit comments