首页
技术
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

handazao

养家糊口
首页
技术
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • Docker使用

  • 数据库相关

  • Java相关

  • Linux学习

  • 工具

  • vue3

  • Git

    • pre-commit
    • commit-msg
      • 1.在项目.git\hooks目录里面编写commit-msg文件
    • pre-push
  • 技术
  • Git
handazao
2024-08-07
目录

commit-msg

# 1.在项目.git\hooks目录里面编写commit-msg文件

#!/bin/sh

echo "-----------------------------当前操作是: commit-msg-----------------------------"

# 用 `` 可以将命令的输出结果赋值给变量
# 获取当前提交的 commit msg
commit_msg=`cat $1`

# 获取用户 email
email=`git config user.email`
msg_re="^(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|release|workflow)(\(.+\))?: .{1,100}"
if [[ ! $commit_msg =~ $msg_re ]]
then
    echo "不合法的 commit 消息提交格式,请使用正确的格式:\
    详情请查看 git commit 提交规范:https://github.com/o-w-o/way/blob/master/appendixs/wiki/git-commit.md"
    # 异常退出
    exit 1
fi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#git
上次更新: 2024/08/07, 16:14:27
pre-commit
pre-push

← pre-commit pre-push→

最近更新
01
pre-push
08-07
02
pre-commit
08-07
03
vue3核心技术
06-27
更多文章>
Theme by Vdoing | Copyright © 2020-2024 handazao | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式