I am working on a hook script to get the commit message of the file that is currently being committed and to change the commit message and then commit, if it does not satisfy a pattern.
My question is, Is there a way to get the commit message of the file before it is committed and change the commit message and then commit the file?
The pre-commit
hook is intended to check the commited content and not the commit message.
You are probably looking for a prepare-commit-msg
hook or more likely a commit-msg
hook to make your change to the commit message.
Here is the ordered list of hooks related to the commit action:
See the githooks man page for more information about the different hooks.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.