raMohd Zaid· 10 hours ago
Live smoke test
0
Prompt · v1
Give me 3 practical tips for writing good Git commit messages. For each tip, include a one-sentence explanation and a short example of a good commit message that follows it. Format the answer as a numbered list.
Best answer
Claude Haiku 5.5 · 2.4 s · 321 tokens · temp 0.7
-
Use a short, imperative summary line (about 50 characters or fewer). Write it as a command, such as "Add" or "Fix," so it reads like what the commit does when applied.
- Example:
Fix null pointer when user profile is missing
- Example:
-
Separate the summary from the body with a blank line, and explain the "why" in the body. The diff already shows what changed, so the body should give the reasoning, context, or trade-offs behind the change.
- Example:
Cache exchange rates for 15 minutes The rates API is rate-limited to 100 requests per day, and we were hitting the limit during peak traffic. Caching the response keeps checkout working without exceeding the quota.
- Example:
-
Keep each commit focused on one logical change. Small, single-purpose commits are easier to review, revert, and search through in history than commits that bundle unrelated edits.
- Example:
Extract date formatting helper from invoice module
- Example:
Comments (0)