git revert未触发提交消息钩子

git revert未触发提交消息钩子,git,hook,Git,Hook,在执行git还原时,将显示一个提交消息编辑器,其中显示默认消息“revert'originalMsg'”。我想在用户编辑默认的恢复消息后触发一个钩子。然而,git revert似乎只会触发pre-commit msg和post-commit钩子,如前所述 对我来说,在pre-commit msg中加入消息检查钩子还为时过早,我需要在提交编辑器关闭并且用户保存了新消息之后触发钩子 steps: 1. git revert commit_id 2. pre-commit-msg hook is tr

在执行git还原时,将显示一个提交消息编辑器,其中显示默认消息“revert'originalMsg'”。我想在用户编辑默认的恢复消息后触发一个钩子。然而,git revert似乎只会触发pre-commit msg和post-commit钩子,如前所述

对我来说,在pre-commit msg中加入消息检查钩子还为时过早,我需要在提交编辑器关闭并且用户保存了新消息之后触发钩子

steps:
1. git revert commit_id
2. pre-commit-msg hook is triggered >>> **too early to put here my checks**
3. editor commit msg
4. close editor msg >> **after close I need to triger check-msg HOOK**
5. post-commit hook is triggered

在post commit中,已完成提交。钩子被触发,但即使mesage语法失败,提交仍会完成。对于
git commit
git merge
,您可以在编辑和保存保存保存提交消息的文件后以及在钩子
commit msg
中完成提交之前检查提交消息。但是,
git revert
不会调用
commit msg
,除非使用
git revert-n&&git commit