how do i read the commit message in pre-commit hook #1171
-
hi i want to check commit message with regex pattern but the problem is ` #!/usr/bin/env sh message="$(cat $1)" echo "MSG".$message ` |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The pre-commit hook doesn't have access to the commit message. You'll need to use the commit-msg hook to have access to the path that the temp file is saved in with the message, then you can read it. |
Beta Was this translation helpful? Give feedback.
-
@dbowling I'm a little late to the party, but maybe you could point me in the right direction. This is why we would like to skip the linting script when the commit is Any ideas on how to resolve this? |
Beta Was this translation helpful? Give feedback.
The pre-commit hook doesn't have access to the commit message. You'll need to use the commit-msg hook to have access to the path that the temp file is saved in with the message, then you can read it.