提示:请根据自己项目实际提交名进行修改
本人使用的脚本模板:
@echo off
title GIT一键提交
color 3
echo 当前目录是:%cd%
echo;
echo 开始添加变更:git add .
git add .
echo;
set /p declation=输入提交的commit信息:
git commit -m "%declation%"
echo;
echo 将变更情况提交到远程自己分支:git push origin hlt
git push origin hlt
echo;
echo 切换主分支:git checkout master
git checkout master
echo;
echo 本地主分支拉取远程主分支:git pull origin master
git pull origin master
echo;
echo 主分支合并分支:git merge hlt
git merge hlt
echo;
echo 将变更情况提交到远程主分支:git push origin master
git push origin master
echo;
echo 切换分支:git checkout hlt
git checkout hlt
echo;
echo 本地分支拉取远程主分支:git pull origin master
git pull origin master
echo;
echo 执行完毕!
echo;
pause
运行效果图:
同事使用的脚本模板:
:: 输入提交内容
set /p commit_msg=Please input commit message:
:: 添加
git add .
:: 提交
git commit -m "%commit_msg%"
:: 推送到远程副分支 fz
git push origin fz
:: 切换到master
git checkout master
:: 拉取主分支代码
git pull origin master
:: 合并分支
git merge fz
:: 推送到主分支
git push origin master
:: 切换到fz
git checkout fz
:: 停顿
pause
两者只是有些写法不同,表达的意思是相同的,脚本很简单,可以根据自己的需求进行修改。