加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
git.sh 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
xukangKen 提交于 2024-11-08 10:35 . feat: #更新提交脚本
#!/bin/bash
# 函数
function echoMsg(){
echo -e ${1}
}
git add .
#是否是主分支
read -p "是否是主分支[y/n]" branch
if [ "$branch" == "y" ]
then
# 选择提交类型
read -p "提交类型 [a/u/f]:" comfirm
#新增
if [ "$comfirm" == "a" ]
then
read -p "输入commit信息:" gitCommit
git commit -m "add: #$gitCommit"
#更新
elif [ "$comfirm" == "u" ]
then
read -p "输入commit信息:" gitCommit
git commit -m "feat: #$gitCommit"
#修复
elif [ "$comfirm" == "f" ]
then
read -p "输入commit信息:" gitCommit
git commit -m "fix: #$gitCommit"
fi
echoMsg "\n\n*************** 正在提交代码... ***************\n\n"
git push -u origin master
else
read -p "请输入分支名称:" branchName
# 选择提交类型
read -p "提交类型 [a/u/f]:" comfirm
#新增
if [ "$comfirm" == "a" ]
then
read -p "输入commit信息:" gitCommit
git commit -m "add: #$gitCommit"
#更新
elif [ "$comfirm" == "u" ]
then
read -p "输入commit信息:" gitCommit
git commit -m "feat: #$gitCommit"
#修复
elif [ "$comfirm" == "f" ]
then
read -p "输入commit信息:" gitCommit
git commit -m "fix: #$gitCommit"
fi
echoMsg "\n\n*************** 正在提交代码... ***************\n\n"
git push origin $branchName
fi
read -p "脚本运行结束"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化