1_for_first_time_file_upload_only.bat
@echo off
REM Prompt the user for their GitLab username
set /p username=Enter your Fullname:
REM Prompt the user for their GitLab email
set /p email=Enter your GitLab email:
REM Prompt the user for the GitLab project URL
set /p gitlabURL=Enter the GitLab project URL:
REM Prompt the user for the commit message
set /p commitMessage=Enter the commit message:
REM Initialize the Git repository
git init --initial-branch=main
REM Configure the user name and email
git config --global user.name "%username%"
git config --global user.email "%email%"
REM Add the remote GitLab repository
git remote add origin "%gitlabURL%"
REM Fist pull the repository to sync remote with local repository
git pull origin main
REM Check the Git status
git status
REM Add all files to the staging area
git add .
REM Commit the changes with the provided message
git commit -m "%commitMessage%"
REM Push the changes to the remote GitLab repository
git push -u origin main
REM Display success message
echo Success! Press any key to exit.
pause
2_from_second_time_file_upload.bat
@echo off
REM Prompt the user for the commit message
set /p commitMessage=Enter the commit message:
REM Check the Git status
git status
REM Add all files to the staging area
git add .
REM Commit the changes with the provided message
git commit -m "%commitMessage%"
REM Push the changes to the remote GitLab repository
git push -u origin main
REM Display success message
echo Success! Press any key to exit.
pause
3_only_if_second_step_fails.bat
@echo off
REM Prompt the user for the commit message
set /p commitMessage=Enter the commit message:
REM Fist pull the repository to sync remote with local repository
git pull origin main
REM Check the Git status
git status
REM Add all files to the staging area
git add .
REM Commit the changes with the provided message
git commit -m "%commitMessage%"
REM Push the changes to the remote GitLab repository
git push -u origin main
REM Display success message
echo Success! Press any key to exit.
pause
4_only_if_third_step_fails.bat
@echo off
REM Prompt the user for the commit message
set /p commitMessage=Enter the commit message:
REM Fist pull the repository to sync remote with local repository for different branches in a repository
git pull origin main --allow-unrelated-histories
REM Adding commit for the reason of pull
git commit -m "Merge remote-tracking branch"
REM Check the Git status
git status
REM Add all files to the staging area
git add .
REM Commit the changes with the provided message
git commit -m "%commitMessage%"
REM Push the changes to the remote GitLab repository
git push -u origin main
REM Display success message
echo Success! Press any key to exit.
pause
0 comments:
Post a Comment