git commit 检查脚本
2023-02-19 12:22:15 时间
#!/bin/sh
MSG=`awk '{printf("%s",$0)}' $1`
if [ ${#MSG} -lt 10 ]
then
echo "-------------------------------------------------------------------"
echo "当前提交的 commit message 为: $MSG"
echo "commit message 只有${#MSG}字符"
echo "message的长度不能小于10, 本次提交失败,请完善commit message,再提交"
echo "-------------------------------------------------------------------"
exit 1
fi
if [[ $MSG =~ ^feat:[[:blank:]].* ]] ||
[[ $MSG =~ ^feat(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^fix:[[:blank:]].* ]] ||
[[ $MSG =~ ^fix(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^style:[[:blank:]].* ]] ||
[[ $MSG =~ ^style(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^refactor:[[:blank:]].* ]] ||
[[ $MSG =~ ^refactor(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^docs:[[:blank:]].* ]] ||
[[ $MSG =~ ^docs(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^test:[[:blank:]].* ]] ||
[[ $MSG =~ ^test(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^chore:[[:blank:]].* ]] ||
[[ $MSG =~ ^chore(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]feat:[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]feat(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]fix:[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]fix(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]style:[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]style(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]refactor:[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]refactor(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]docs:[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]docs(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]test:[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]test(.*):[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]chore:[[:blank:]].* ]] ||
[[ $MSG =~ ^revert:[[:blank:]]chore(.*):[[:blank:]].* ]]
then
exit 0
else
echo "-------------------------------------------------------------------"
echo "当前提交的 commit message 为: $MSG"
echo "本次提交失败,请参考 commit message 提交规范"
echo "-------------------------------------------------------------------"
exit 1
fi
相关文章
- HTML5项目笔记3:使用Canvas设计离线系统的Logo
- linux系统开mc服务器
- 红队技术-Cobaltstrike之Linux上线
- 权限维持-Linux后门
- 万万没想到,go的数据库操作,也能像php一样溜了
- Typora+PicGo+GitHub实现图片快速上传
- Linux计划任务服务程序
- 2022 如何在 GitHub 上搭建个人网站(github.io)
- 虚拟机安装linux无法访问外网解决办法
- 用过 mongodb 吧, 这三个大坑踩过吗?
- 教你配置windows上的windbg,linux上的lldb,打入clr内部这一篇就够了
- MongoDB 在评论中台的实践
- 使用mongodb作为Quartz.Net下的JobStore实现底层的持久化机制
- mongodb之使用explain和hint性能分析和优化
- mongodb 3.x 之实用新功能窥看[2] ——使用$lookup做多表关联处理
- mongodb 3.x 之实用新功能窥看[1] ——使用TTLIndex做Cache处理
- 双十一来了,别让你的mongodb宕机了
- GO语言开发环境搭建笔记
- PHP判断网络连通
- 开启phpMyAdmin的远程登录