Re:Write good git commit messages
by TbobbyZ on Wednesday December 12, 2018 @08:37AM
(#18663716)
What's the point of adding a sentence or two to a commit message? I only include a keyword and the issue number, e.g. "Closed #41" or "Fixed #41". This will link the commit to the GitHub issue, which will allow any users to see all the details they need about what was involved in the commit message.
[ Parent
| on HN ]
That’s not particularly helpful if you’re looking back through git logs or at a git blame. Unless you’ve memorized the context of every github issue you have.
Also what if you move from github to bitbucket? Or self hosted git?
Git provides a great way to keep your changelogs directly next to the code, why not use it?
It's drastically less helpful if anyone ever wants to look at the code separate from whatever issue-tracker you're currently using. Are you confident those IDs will be preserved (in a useful form) if you ever want to migrate away from Github?
This assumes that you have access to the issues page. That's not always the case (when working as a contractor for instance). Also, tickets are not always filled properly, and often changes are not accompanied by a ticket. You get so many bonuses from writing good commit messages:
-> Overview of the latest changes without having to open additional links. Very handy for git bisects for instance.
-> Automatic generation of change logs.
-> It enforces changes that are purposeful and well scoped.
-> Knowledge stays with the Git repo. No data migration issues if you decide not to use GitHub anymore for instance...
-> And finally... it really just looks nice and professional. I would not take a project seriously if the Git log was just an aggregation of WIPs and Oopsies.