Complete the code to make a Git hook script executable.
chmod [1] .git/hooks/pre-commitThe chmod +x command makes the hook script executable so Git can run it.
Complete the first line of a Git hook script to specify the shell interpreter.
#![1]/sh
The shebang #!/bin/sh tells the system to use the shell interpreter to run the script.
Fix the error in the Git hook script line that prevents commit if a file named TODO exists.
if [ -f [1] ]; then echo "Please resolve TODOs before commit." exit 1 fi
The file name should be unquoted in the test expression to correctly check if the file exists.
Fill both blanks to create a pre-commit hook that checks for 'TODO' in staged files and blocks commit.
if git diff --cached | grep -q [1]; then echo [2] exit 1 fi
The script checks if any staged file contains 'TODO' and prints a blocking message if found.
Fill all three blanks to create a post-commit hook that logs the last commit message to a file.
git log -1 --pretty=[1] > [2] echo "Logged commit message to [3]"
%s which only shows the commit subject.The git log command with --pretty=%B outputs the full commit message body. The output is redirected to a log file, and a confirmation message is printed.