git config_error ai_generated true

warning: commit message exceeds 72 characters; might be truncated by some tools

ID: git/commit-message-too-long-warning

Also available as: JSON · Markdown · 中文
95%Fix Rate
85%Confidence
1Evidence
2023-07-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
git 2.20 active
git 2.35 active
git 2.42 active

Root Cause

Git's default commit message length limit (72 characters) is exceeded, but this is a warning, not an error.

generic

中文

Git 默认的提交信息长度限制(72 个字符)被超过,但这只是一个警告,不是错误。

Official Documentation

https://git-scm.com/docs/git-commit#_discussion

Workarounds

  1. 95% success Shorten the commit message to under 72 characters, or use a multi-line commit message with a summary line under 50 characters: git commit -m 'Short summary' -m 'Longer body here...'
    Shorten the commit message to under 72 characters, or use a multi-line commit message with a summary line under 50 characters: git commit -m 'Short summary' -m 'Longer body here...'
  2. 70% success If you must keep the long message, configure git to allow longer lines: git config advice.commitMessageLength false (this suppresses the warning but doesn't guarantee tool compatibility).
    If you must keep the long message, configure git to allow longer lines: git config advice.commitMessageLength false (this suppresses the warning but doesn't guarantee tool compatibility).

中文步骤

  1. Shorten the commit message to under 72 characters, or use a multi-line commit message with a summary line under 50 characters: git commit -m 'Short summary' -m 'Longer body here...'
  2. If you must keep the long message, configure git to allow longer lines: git config advice.commitMessageLength false (this suppresses the warning but doesn't guarantee tool compatibility).

Dead Ends

Common approaches that don't work:

  1. 40% fail

    The warning is a best practice; disabling it may cause issues with tools like email or changelog generators that expect short lines.

  2. 30% fail

    This only suppresses the warning but doesn't fix the underlying issue; long messages may still be truncated by external tools.