gitlab提交测试分支的命令和流程

写在前面

复制代码
先npm run lint:eslint 先走一遍代码校验然后再提交

先把检验跑了再add commit push那些

注意一下这个问题:git commit规范不对导致报错subject may not be empty[subject-empty]type may not be empty[type-empty].

配置lint检查后, 使用commitlint之后报错:

报错信息:

复制代码
⧗ input: feat:初始化项目
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
husky - commit-msg hook exited with code 1 (error)文章地址https://www.yii666.com/blog/367551.html

正确是的:

复制代码
git commit -m 'fix: 初始化项目'

首先你已经在zoulipeng-dev分支把代码写好了,现在git checkout dev切换到dev分支(即:自动化部署的测试分支dev),然后你的组员随时可能都会改动提交代码的,所以得先git pull就是下拉下最新的代码,然后你在dev测试分支上merge zoulipeng-dev分支的代码,然后手动解决冲突,然后

复制代码
git add .

git commit -m 'fix: 初始化项目'

git push

新版本使用commitlint规范git 提交内容

测试当前提交的commit

复制代码
git commit -m "foo: 这是错误的提交,因为foo不在允许的类型中"

提示以下错误:

复制代码
⧗   input: foo: 这是错误的提交,因为foo不在允许的类型中
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]
✖   found 2 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
husky - commit-msg hook exited with code 1 (error)

正确的提交commit

复制代码
chore: 添加了 commitmsg 的校验功能

规范commit

提交格式(注意冒号后面有空格)

复制代码
git commit -m <type>[optional scope]: <description>

示例:

复制代码
git commit -m "feat: 新增首页模块"

带修改范围的示例

复制代码
git commit -m 'fix(home): 修复页面样式问题'

常用的type类型:

类型 描述
build 编译相关的版本,例如发布版本,对项目构建或者依赖的改动
chore 其他修改,比如改变构建流程,或者增加依赖库,工具等。
ci 持续集成修改
docs 文档修改
feat 新特性,新功能
fix 修改bug
perf 优化相关,比如提升性能,体验
refactor 代码重构
revert 回滚到上一个版本

The end.

相关推荐
JiayinX16 小时前
CI/CD流程搭建【Docker+jenkins+gitlab+Webhook】01
ci/cd·docker·gitlab·jenkins·webhook
甜甜不吃芥末17 小时前
GitLab 配置 SSH 密钥完整教程
运维·ssh·gitlab
成为你的宁宁2 天前
【基于 GitLab Webhook 的 Jenkins 自动触发构建实现手册:涵盖概念原理、环境配置、故障处理及 Tag/Commit 维度参数化构建实践】
自动化·gitlab·jenkins
邵伯正在输入2 天前
如何同时管理GitLab/GitHub的SSH密钥
ssh·gitlab·github·intellij idea
一条懒鱼6663 天前
Jenkins 2.528.3 与 GitLab 深度集成:实现自动构建
servlet·gitlab·jenkins
爱宇阳4 天前
在 Docker 环境中为 GitLab 实例配置邮件服务器
java·docker·gitlab
爱宇阳4 天前
使用 Docker 容器备份 GitLab 实例教程
docker·容器·gitlab
爱宇阳4 天前
使用 Docker 容器备份与 Docker Compose 升级 GitLab 实例教程
docker·eureka·gitlab
初学者_xuan6 天前
Git&GitLab安装gitlab(rocky系统)
git·gitlab
凤凰战士芭比Q6 天前
DevOps理念、Git(Git常用命令)、Gitlab仓库
git·gitlab·devops