4 ms·
Can you give some examples of good commit messages?
by fatfox 4y ago
Can you give some examples of good commit messages?
- TedDoesntTalk 4y agoSubjective and also depends on the culture where you work. I’ve worker at places where the majority of the “why” Is in a JIRA ticket, so the commit message better reference that ticket number. Not so at other places. See what I mean?
- PUSH_AX 4y agoOr, just squash your commits and focus on bigger things.
- OJFord 4y agoSquash away, but into one with a good commit message, please.
- codingminds 4y agoAs already mentioned: It depends. But this might be a good start: https://www.conventionalcommits.org/en/v1.0.0/#summary https://www.conventionalcommits.org/en/v1.0.0/#summary We've used this as a starting point and adapted it to our needs (E.g. some simplification, defining the possible values for scope, etc.)
- naet 4y agoA bad commit (that one of my coworkers always does) is "update file.ext". Says nothing other than the name of the file that was updated, which ends up with tons of repeat commit messages for common files and provides zero info that wasn't already included in the commit itself. Another poor commit is a description like "adds padding". It's a little too vague and doesn't really tell you much that wasn't already apparent by looking at the change itself. A better commit might be something more like "Add variable padding to ProductLogo component, fixing logo overflows for issue#78". It summarizes the change, the intended outcome of the change, the reason for the change and a reference to an issue all in one short sentence. You don't have to go into overwhelming detail for every minor front end change but if you're intelligently tracking and squashing your commits writing them well can help a lot later on if you ever need to understand the context of an older commit or even a given line in the codebase.
- dkdbejwi383 4y agoYou forgot my least favourite commit message: “fix PR comments” for a commit that changes 5 unrelated things
- suprfnk 4y agoBut then, putting those 5 unrelated things in the 5 commits that they belong to is a PITA.
- dkdbejwi383 4y agoSure, but I'd prefer 5 new commits that describe the change individually - at least that way I can review each commit individually
- petepete 4y agoThe 'update thing.xyz' one is the default commit message made when editing files using the GitHub web interface. If it's a developer actually typing that in I'd be disappointed.
- scrollaway 4y agoTake a look at Wine's commit log. It's really well curated. https://github.com/wine-mirror/wine/commits/master https://github.com/wine-mirror/wine/commits/master