用脚本文件来简化工作流程,现在写个简单的例子
定义变量
# 未输入commit提示
$noCommit = '未输入commit,请重新执行脚本'
定义函数
# 代码更新流程
function update() {
if ($commitInfo) {
git commit -m $commitInfo
git pull
git push
}
else {
$noCommit
}
}
执行
# 执行代码更新流程
git add .
$commitInfo = Read-Host "commit"
update
项目运行中的问题
- 遇到代码冲突会自动停止
- 无法捕获git代码冲突报错