The 50/72 Rule and Message Formatting
What you'll learn: How to format commit messages using the 50/72 character convention for clarity and consistency.
What Is the 50/72 Rule?
The 50/72 rule is a widely-adopted convention for structuring commit messages in Git. It consists of two simple guidelines:
- Subject line: Keep it to 50 characters or less
- Body text: Wrap lines at 72 characters
Think of your commit message like an email: the subject line should be a clear, scannable summary, while the body provides necessary details. Just as you wouldn't write a novel in an email subject, you shouldn't cram everything into your commit's first line.
Why These Specific Numbers?
The 50-character limit for subject lines ensures they display nicely in git log --oneline, GitHub's commit lists, and email subject lines (which traditionally truncate around 50-60 characters). This forces you to be concise and descriptive.
The 72-character wrap for body text comes from traditional terminal widths (80 characters) minus some margin for Git's formatting when displaying logs. This ensures your message is readable without horizontal scrolling in any environment.
How It Looks
Add user authentication to login endpoint
This commit implements JWT-based authentication for the
/login endpoint. Users now receive a token upon successful
login, which must be included in subsequent API requests.
The change improves security and enables session management
across multiple devices.
Notice: the subject is under 50 characters, there's a blank line separating it from the body, and each body line wraps before hitting 72 characters.
Key Takeaway: The 50/72 rule makes commit messages readable across all Git tools and terminals—50 characters for subjects, 72 for body lines, with a blank line between them.