Using strace I noticed that git-revert invokes only two hooks:
But git-commit invoke these four:
Since git-revert produces a commit, why doesn't it invoke the same
hooks as git-commit?
I couldn't find any discussing about this in the list or elsewhere. So
I'm asking here.
I ended up researching this when I was implementing a hook to detect
and deny commits which revert merge-commits, since they are
I tried to implement it as a commit-msg hook to search for the string
"This reverts commit SHA-1" in the commit message. But git-revert
doesn't invoke the commit-msg hook.
So, for now I implemented my check as a pre-receive hook. But I find
it useful to have all pre-receive checks implemented also as a
pre-commit or a commit-msg hook so that I can detect problems at
commit time instead of only at push time.