Hacker News new | ask | show | jobs
Git commit messages: Why or what? (steverydz.com)
3 points by steverydz 1498 days ago
2 comments

In my opinion, commit messages should say "what" changed, if necessary "why," and usually not "how."

This person has a similar guideline:

https://cbea.ms/git-commit/#why-not-how

- "Why" can sometimes be inferred easily from "what," e.g. for some simple bug fixes, but sometimes not, so that's a judgement call. (I don't think I'm disagreeing with the website here; I'm just saying that sometimes "why" doesn't need explicit language.) - To answer "how," directly reading the code or the code diff is usually the best way. - "What" can also be answered by reading the code diff, but providing a high-level summary in the commit message can save future maintainers a lot of time.

I usually leave the JIRA ticket number (which links back to the ticket) as the “why”