Commit-editmsg

  • Launch Editor: Git opens your configured editor with this file.
  • User Edits: You write your commit message. You may also delete all comment lines – Git will ignore any line starting with # when parsing the final message.
  • Save & Exit: You save the file and close the editor.
  • Read by Git: Git reads .git/COMMIT_EDITMSG.
  • Strip Comments: Git removes all comment lines (lines starting with #).
  • Validation:
  • Create Commit Object: Git creates a new commit object with that message.
  • Cleanup (optional but typical): Git may delete or overwrite COMMIT_EDITMSG after the commit succeeds. However, in many cases, the file persists with the last commit message until the next commit starts. Do not rely on it for permanent storage.
  • The COMMIT-EDITMSG file enforces (or at least encourages) best practices that -m actively discourages.

    You saved an empty file, or a file with only comments (#). Git reads COMMIT-EDITMSG, strips comments, and sees nothing. Fix: Run git commit again and write a message. COMMIT-EDITMSG

    Need Help?
    Select your currency