git - 是否可以检查 git 提交以包含特定字符?
问题描述
Git爱好者
我必须在我的 git 提交中包含“#+story number”,但有时我忘记提及它。我正在寻找一种方法来防止我的错误提交!我找到了这个文件,正如它所说,用这个内容修改了 .git/hooks/commit-msg.sample 文件(仅用于测试):
#!/usr/bin/env ruby
message_file = ARGV[0]
message = File.read(message_file)
$regex = /\[ref: (\d+)\]/
if !$regex.match(message)
puts "[POLICY] Your message is not formatted correctly"
exit 1
end
但它没有用!您对此有什么经验或想法吗?此致
解决方案
推荐阅读
- android - 如何在材料日期范围选择器中获取开始日期和结束日期之间的日期
- typescript - 如何制作只能允许更新特定属性的功能?
- django - Django: GroupBy: 并显示其他列
- ios - 在 Swift 表视图中不填充 Firebase 数据
- python - 使用 Openpyxl 从带有溢出数据的单元格中获取数据
- discord.py - 如何显示命令检查命令?
- ruby - Ruby 客户端-服务器套接字拥塞
- sql - 确定新值时从 1 开始计数
- python - 我需要在同一个 tkinter 组合框上执行多个绑定语句,但只有第一个可以工作
- python - 如何使用 list *args 创建函数到字典?