Web lists-archives.com

hook to get info on commit, and include that in a file that is part of the commit

Is there any way using a git hook to get info on the commit (id,
message), put that in a file, and include that file in the commit?

If I try that in a pre-commit hook I do not get the info on the
current commit. I tried it in pre-receive but it does not seem to get
executed at all.

If I do it in post-receive it's too late to check the file in with the commit.

Os there no way to do this?