149 lines
2.9 KiB
Batchfile
149 lines
2.9 KiB
Batchfile
@echo off
|
||
:: ======================================
|
||
:: RPG Maker MV Git 管理脚本
|
||
:: 功能:提交更改、提交并推送、创建新分支、切换分支、合并分支、回滚到指定提交
|
||
:: 远程仓库链接:http://45.93.30.102:3001/guarp/phnta.git
|
||
:: ======================================
|
||
title RMMV Git 管理脚本
|
||
|
||
:MENU
|
||
cls
|
||
echo =====================================
|
||
echo RMMV Git 管理脚本
|
||
echo =====================================
|
||
echo 1. 提交更改
|
||
echo 2. 提交并推送
|
||
echo 3. 创建新分支
|
||
echo 4. 切换分支
|
||
echo 5. 合并分支
|
||
echo 6. 回滚到指定提交
|
||
echo 7. 退出
|
||
echo =====================================
|
||
set /p option=请选择操作 (1-7):
|
||
|
||
if "%option%"=="1" goto COMMIT
|
||
if "%option%"=="2" goto COMMIT_PUSH
|
||
if "%option%"=="3" goto BRANCH_CREATE
|
||
if "%option%"=="4" goto BRANCH_SWITCH
|
||
if "%option%"=="5" goto MERGE_BRANCH
|
||
if "%option%"=="6" goto ROLLBACK
|
||
if "%option%"=="7" goto EXIT
|
||
|
||
echo 无效选项,请重新选择...
|
||
pause
|
||
goto MENU
|
||
|
||
:COMMIT
|
||
cls
|
||
echo ===== 提交更改 =====
|
||
set /p commit_msg=请输入提交信息:
|
||
echo 正在添加文件...
|
||
git add .
|
||
echo 正在提交更改...
|
||
git commit -m "%commit_msg%"
|
||
if errorlevel 1 (
|
||
echo 提交失败,请检查错误信息
|
||
) else (
|
||
echo 提交成功!
|
||
)
|
||
pause
|
||
goto MENU
|
||
|
||
:COMMIT_PUSH
|
||
cls
|
||
echo ===== 提交并推送 =====
|
||
set /p commit_msg=请输入提交信息:
|
||
echo 正在添加文件...
|
||
git add .
|
||
echo 正在提交更改...
|
||
git commit -m "%commit_msg%"
|
||
if errorlevel 1 (
|
||
echo 提交失败,请检查错误信息
|
||
pause
|
||
goto MENU
|
||
)
|
||
echo 提交成功!
|
||
REM 检查是否已设置远程仓库 origin,如不存在则添加
|
||
git remote | findstr /I "origin" >nul
|
||
if errorlevel 1 (
|
||
echo 未检测到远程仓库 "origin",正在添加...
|
||
git remote add origin http://45.93.30.102:3001/guarp/phnta.git
|
||
)
|
||
echo 正在推送到远程仓库...
|
||
git push -u origin --all
|
||
if errorlevel 1 (
|
||
echo 推送失败,请检查错误信息
|
||
) else (
|
||
echo 推送成功!
|
||
)
|
||
pause
|
||
goto MENU
|
||
|
||
:BRANCH_CREATE
|
||
cls
|
||
echo ===== 创建新分支 =====
|
||
set /p branch_name=请输入新分支名称:
|
||
git checkout -b %branch_name%
|
||
if errorlevel 1 (
|
||
echo 分支创建失败,请检查错误信息
|
||
) else (
|
||
echo 分支 "%branch_name%" 创建成功,并切换到该分支
|
||
)
|
||
pause
|
||
goto MENU
|
||
|
||
:BRANCH_SWITCH
|
||
cls
|
||
echo ===== 切换分支 =====
|
||
echo 当前分支列表:
|
||
git branch
|
||
echo.
|
||
set /p target_branch=请输入要切换的分支名称:
|
||
git checkout %target_branch%
|
||
if errorlevel 1 (
|
||
echo 切换分支失败,请检查分支名称是否正确
|
||
) else (
|
||
echo 成功切换到分支 "%target_branch%"
|
||
)
|
||
pause
|
||
goto MENU
|
||
|
||
:MERGE_BRANCH
|
||
cls
|
||
echo ===== 合并分支 =====
|
||
echo 当前分支列表:
|
||
git branch
|
||
echo.
|
||
set /p merge_branch=请输入要合并的分支名称:
|
||
echo 正在将分支 "%merge_branch%" 合并到当前分支...
|
||
git merge %merge_branch%
|
||
if errorlevel 1 (
|
||
echo 合并失败,请检查是否有冲突或错误信息
|
||
) else (
|
||
echo 合并成功!
|
||
)
|
||
pause
|
||
goto MENU
|
||
|
||
:ROLLBACK
|
||
cls
|
||
echo ===== 回滚到指定提交 =====
|
||
echo 当前提交记录(最新在上方):
|
||
git log --oneline
|
||
echo.
|
||
set /p commit_id=请输入要回滚到的提交ID:
|
||
echo 正在回滚...
|
||
git reset --hard %commit_id%
|
||
if errorlevel 1 (
|
||
echo 回滚失败,请检查错误信息
|
||
) else (
|
||
echo 回滚成功!
|
||
)
|
||
pause
|
||
goto MENU
|
||
|
||
:EXIT
|
||
echo 脚本结束,再见!
|
||
pause
|
||
exit
|