如果在本地开发时经常发现自己在代码中写出有用的消息。将此代码片段视为一个简单的示例:
# 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, to: 'delivery_report#index'
是否有可能在接受提交之前或在暂存之前告诉 git,它应该警告我代码中包含某些内容的行?在这种情况下,这将是我的评论或任何其他预定义的行。