Linux 在使用Git提交之前检查代码中的消息注释
如果经常发现自己在本地开发时在代码中写下有用的消息。请将此代码段作为简单示例:Linux 在使用Git提交之前检查代码中的消息注释,linux,macos,git,git-commit,pre-commit,Linux,Macos,Git,Git Commit,Pre Commit,如果经常发现自己在本地开发时在代码中写下有用的消息。请将此代码段作为简单示例: # Public API namespace :api do namespace :v1 do # REMOVE THE FIRST LINE WHEN DONE TESTING get :delivery_report, to: 'delivery_report#index' post :delivery_report, to: 'delivery_report#index' end
# Public API
namespace :api do
namespace :v1 do
# REMOVE THE FIRST LINE WHEN DONE TESTING
get :delivery_report, to: 'delivery_report#index'
post :delivery_report, to: 'delivery_report#index'
end
end
这里的要点是,当我完成了,我觉得我终于可以完成我的工作了,我需要记住,我必须删除get:delivery_report这一行,改为:'delivery_reportindex'
是否可以告诉git,在接受提交之前或者在转移之前,它应该警告我代码中有一行内容?在本例中,这将是我的注释或任何其他预定义行。Git支持一个预提交钩子,在该钩子中,您可以测试用户建议提交的内容,并在某些条件适用时强制提交失败 看到和