Commit-editmsg May 2026

git config --global commit.template ~/.gitmessage.txt Create ~/.gitmessage.txt :

Your commit-msg hook can read .git/COMMIT_EDITMSG and reject the commit if it doesn't match the regex: COMMIT-EDITMSG

If you have ever typed git commit without the -m flag, you have interacted with this file. You might have thought you were just using a text editor to write a message. In reality, you were editing a temporary file named COMMIT-EDITMSG . git config --global commit

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. Understanding this file transforms you from a casual

The humble text file changes everything.