Although I agree with Oli Charlesworth's comments that you should not be doing this, it is actually possible. Here is a simple post-commit hook that rewrites the commit, appending the commit message to the file "changelog".
if ! test ${GIT_BYPASS_POST_COMMIT+set}
then
export GIT_BYPASS_POST_COMMIT=1
git show --format=%B -s >>changelog
git add changelog
git commit --amend -C HEAD
fi
If you try this, I expect you will quickly find that it does not play nice with normal use of git. The simplest example is that if you amend a commit, you will be amending the commit that already changes changelog
, so the hook ends up duplicating the commit message.
It's up to you to say whether you want to make an attempt to get this to work, or just give up on it, but I recommend the latter.