Complete the code to make the commit-msg hook executable.
chmod +[1] .git/hooks/commit-msgThe commit-msg hook script must be executable, so we use chmod +x to add execute permission.
Complete the script line to read the commit message file path passed to the commit-msg hook.
commit_msg_file=[1]$0 which is the script name, not the argument.$2 or $# which are not the first argument.The commit-msg hook receives the commit message file path as the first argument $1.
Fix the error in the regex check line to validate commit message starts with a capital letter.
if ! head -1 "$commit_msg_file" | grep -qE '^[1]'; then
The regex ^[A-Z] checks if the first character is an uppercase letter.
Fill both blanks to reject commit messages shorter than 10 characters.
msg_length=$(wc -c < "$commit_msg_file") if [ "$msg_length" [1] [2] ]; then
This checks if the message length is less than 10 characters and rejects it.
Fill all three blanks to print an error and exit with status 1 if validation fails.
echo "[1]" exit [2] # End of hook [3]
Print an error message, exit with status 1 to stop commit, and comment the script end.