当前位置: 首页> 科技> IT业 > 秦皇岛软件开发培训_小程序电商模板_外国网站怎么进入_看b站视频软件下载安装

秦皇岛软件开发培训_小程序电商模板_外国网站怎么进入_看b站视频软件下载安装

时间:2025/7/17 14:55:49来源:https://blog.csdn.net/xy_peng/article/details/145078246 浏览次数:0次
秦皇岛软件开发培训_小程序电商模板_外国网站怎么进入_看b站视频软件下载安装

        默认系统已经安装了git,且运行环境在windows下: ~/.git 通常指的是用户主目录下的.git目录。

1、创建 ~/.gitconfig 文件

[user]name = userName # 配置git usernameemail = userName@mail.com.cn # 配置 git 邮箱
[core]autocrlf = falsehooksPath = ~/.git/hooks # 指定自定义脚本位置
[credential]helper = store
[http]sslVerify = truesslBackend = schannel

2、创建 ~/.git/hooks/commit-msg

#!/bin/sh# Created by Husky v4.3.8 (https://github.com/typicode/husky#readme)
#   At: 2024/8/8 下午8:51:41
#   From: undefined (undefined)
echo "---------开始执行检查脚本----------"
# 获取提交信息文件的路径
commit_msg_file=$1# 读取提交信息
commit_msg=$(cat "$commit_msg_file")# 打印提交信息(可选)
echo "Commit message: $commit_msg"keywords="feat:|fix:|perf:|impr:|ci:|docs:|style:|refactor:|test:|chore:|jvm:|pom:|apm:|conf:|typo:|wip:"
# 定义关键词列表
EXCLUDED_KEYWORDS=("【" "】" "[]" "【】")# 在这里可以添加您需要的逻辑来处理提交信息
# 例如,检查提交信息是否符合某种格式
if ! echo "$commit_msg" | grep -qE "^($keywords)" ; thenecho "Error: Commit message must start with one of the following keywords:[ 'feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'revert', 'build', 'impr','ci','jvm','pom','apm','conf','typo', 'wip']"exit 1
fi# 检查提交信息长度是否超过50字符
if [ ${#commit_msg} -gt 50 ]; thenecho "Error: Commit message length exceeds 50 characters."exit 1
fi# 遍历关键词列表,检查提交信息中是否不包含任何关键词
for keyword in "${EXCLUDED_KEYWORDS[@]}"; doif echo "$commit_msg" | grep -qE "$keyword"; thenecho "Error: Commit message contains an excluded keyword '$keyword'."exit 1fi
doneexit 0

3、测试脚本

默认你已经掌握了git命令的使用,且已有本地git 仓库

npm installgit add .git commit "your message"

关键字:秦皇岛软件开发培训_小程序电商模板_外国网站怎么进入_看b站视频软件下载安装

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: