The humble text file changes everything.
When you run:
#!/bin/sh # .git/hooks/prepare-commit-msg commit_msg_file=$1 branch_name=$(git symbolic-ref --short HEAD) if echo "$branch_name" | grep -qE '[A-Z]+-[0-9]+'; then ticket=$(echo "$branch_name" | grep -oE '[A-Z]+-[0-9]+') echo "[$ticket] $(cat $commit_msg_file)" > $commit_msg_file fi COMMIT-EDITMSG
Understanding this file transforms you from a casual Git user into a Git power user. It is the gateway to crafting perfect commit history, automating quality checks, and integrating seamlessly with modern AI tooling. The COMMIT-EDITMSG file is a transient, temporary file created by Git in the .git/ directory (specifically, .git/COMMIT_EDITMSG ) whenever you initiate a commit that requires an editor. Its sole purpose is to hold the commit message for the commit currently in progress. The humble text file changes everything