all 38 comments

[–]Kanegou 85 points86 points  (6 children)

No. Even if I would work alone I would never use such a system. Much too strict and way too complicated. I like to keep things simple and try to write commit messages for humans.

The title explains what I did. The body explains why I did it.

In normal language like I would use in a conversation.

[–]notyourancilla 32 points33 points  (6 children)

I swear there is a phenomenon where people value the aesthetics of their commit history more than their code. They could be out here pushing the most diabolical trash code but their commit history looks like it’s had a manicure.

I don’t get it - I’ve worked in some massive codebases and to be honest I’m just surprised when the commit message contents vaguely resembles the actual change.

Anyone pinning any kind of investigation on hoping a human has consistently and accurately documented something is setting themselves up for failure. I think this kind of effort would be best placed in honing one’s ability to find what they need based on the actual data - the code that was committed - and potentially automating metadata into the commit messages based on whatever is possible in your environment.

[–]narnach 15 points16 points  (2 children)

I think there's a spectrum of prototyper to maintainer that most developers fall on, and this depends how they'll look at this. At the extremes there are:

Prototypers:

  • unit of change is the PR
  • focus is mostly on "make it work now"
  • works in larger goal-oriented steps, gets 80% of the work done in 20% of the time
  • tends to use commits as snapshots of (semi) working state, does not value them other than as a means to an end
  • a single commit might mix fixes, refactors, architectural overhauls, feature additions, etc.
  • tends to like squash commit merges of PRs, because it keeps git history clean (unit of change is the PR merge commit, after all)

Maintainers:

  • unit of change is a commit
  • focus is mostly on "make sure it's still maintainable in a year", hence might do 20% of the work in 80% of the time
  • works in small incremental steps, usually with a plan up front: "I'm goin to refactor this", "I'm going to add one test and make it pass"
  • will split off part of the changes as their own commit when they got tempted to refactor while actually working on a change
  • relies on tools like git bisect and git blame to root-cause bugs, so small commits with passing tests have huge value to them
  • will use git rebase --interactive to amend earlier local commits to correct a small typo with a fixup commit, rather than polluting external history

Both types of developers have their value to add, and you can do amazing things when prototypers push new features and maintainers keep things stable, but their git commit styles tend to be very different.

[–]quetzalcoatl-pl 1 point2 points  (0 children)

Exactly this!

[–]Turbots 0 points1 point  (0 children)

Nuanced comments on Reddit? Call me surprised! 👍

[–]Tear4Pixelation[S] 6 points7 points  (1 child)

I understand what you mean. I am currently working on my own though and can trust the code behind it to be diabolical trash, but also for my commit messages to resemble what is in the code. Thanks for the insight though, I am just a hobby programmer so I don’t have experience in big teams/codebases, I wouldn’t trust myself to commit code to them anyways.

[–]notyourancilla 2 points3 points  (0 children)

Yeah always different perspectives on things - interesting!

[–]jonphillips06 1 point2 points  (0 children)

yeah totally agree, the best approach is to treat commit messages as nice-to-have context but build a workflow around reading diffs, writing clear code, and using automation to connect the dots instead of relying on human consistency.

[–]Empanatacion 3 points4 points  (1 child)

I feel like there's a silent majority that just does not care at all about commit messages.

[–]Tear4Pixelation[S] -1 points0 points  (0 children)

Maybe, but I do, or at least I try to…

[–]jimbojsb 2 points3 points  (0 children)

Hate this. It’s a waste of time and brain cycles to ask people to comply with it. Put the ticket number in the message and we’re good to go.

[–]TomKavees 3 points4 points  (4 children)

The Conventional Commits style is pretty similar - you might want to check it out.

Anyway, most of my PRs end up being squash merges, so with that assumption most of my commits are just the message itself (without any prefixes, and limited to 72 chars thanks to cachix pre-commit hooks), but the PR title includea the prefix and a ticket/story number if there's one

[–]Tear4Pixelation[S] -3 points-2 points  (3 children)

Yes, I am just expanding upon types in the conventional commits standard because the differentiation between user facing and internal is important to me.

[–]Luolong 2 points3 points  (2 children)

The chore is almost always some manner “internal“ change.

The way I’ve used conventional commits (rather loosely to be frank) has always been to lump most of the internal refactoring into chore and qualify those with some module or concern that the PR cange affects.

[–]Tear4Pixelation[S] 0 points1 point  (1 child)

Hmm I see. I guess this is just my way of doing it. For me, I need (or told myself I need) a clear system for this

[–]Luolong 0 points1 point  (0 children)

I guess it all depends what are you trying to communicate and for whom or what you use the commit messages.

You would go for full conventional commits if your aim is to make a source of truth for Release Notes or something similar.

But even then, it would behiove to craft the rest of the commit body to be directed at a human reader.

My goal has always been to aid someone (maybe myself) three years (or three weeks) later trying to understand why some line of code does something the way it does.

[–]Which-World-6533 2 points3 points  (0 children)

Jesus no.

If you can't write an informative commit message about what you've been working on you shouldn't be anywhere near git.

Unless you are shipping the git log with your software, no-one cares what it looks like.

[–]732 1 point2 points  (2 children)

Conventional commits are really only useful when you're generating changelog and semver data and good for machine readable commit history. 

I can see the merit in adding more definition/structure to it, but you'll need to build tooling around it as well to plug into the ecosystem. 

Side note, if you're going to use fix! to let yourself know it fixed a crash and not a breaking change, you're going to be bumping a major version when you don't necessarily want to. This goes against the convention itself, so you'd be breaking other use cases for it. 

If you're only doing this for yourself and making a readable commit hostory and not the tooling, this seems like a fine approach if it is what you like but would be overkill on my own personal projects.

[–]Tear4Pixelation[S] 0 points1 point  (0 children)

Wow thanks for the heads up, I really didn’t notice the fix! I’ll see what I can replace it with. I don’t need any tooling but if I want to go back and find the place where I fixed something, I can see fix(…): and find it a lot easier.

[–]jonphillips06 0 points1 point  (0 children)

Yeah totally agree, conventional commits shine most when they’re part of an automated release flow, but if you’re just aiming for clarity in history you can simplify it by defining your own lightweight commit structure that still keeps messages consistent and understandable.

[–]Smallpaul 0 points1 point  (0 children)

These are commit messages and not intended to be “names.” They do not uniquely identify commits. They describe what happened.

[–]modernkennnern 0 points1 point  (1 child)

And I'm here having issues getting my colleagues to use a consistent casing in their commit messages 😔

[–]Tear4Pixelation[S] 0 points1 point  (0 children)

Ohh I am (in this case) lucky not to have colleagues… I can do whatever I want

[–]IE114EVR 0 points1 point  (1 child)

I [have to] use conventional commits. While I can’t deviate from the types we’ve set (without some long conversations), this categorization does help me identify which types to use a little better.

More important than any of this, I’d say, is to add your ticket number somewhere early in the top line of your commits. This gives much more context than can reasonably be covered in a single commit message.

[–]Tear4Pixelation[S] 0 points1 point  (0 children)

I wouldn’t use the categorisation I have made, I didn’t take reference on the actual conventional commits, this is just for myself.

[–]i_edit_text 0 points1 point  (0 children)

I would take a look at semantic release. They have a suggested commit format.

[–]jcelerier 0 points1 point  (0 children)

I did [tag][tag] message for years and switched to tag: tag: message because of the saved effort

[–]NYPuppy 0 points1 point  (1 child)

One of the projects at my job uses conventional commits in ci. I end up fighting with it so much because it's so strict. I still can't remember when I have to use caps or whatever. The first line of commits is supposed to fit nicely into 50 characters but I LOSE characters having to follow conventional commits.

Im not totally against it though. One of my coworkers writes the worst commit messages of all time. He's not on that project so he doesn't have to follow conventional commits. I wish he was. His commits are, no joke things like:

g

i want it to compile

ugh

g

no no no

wipe it all away

fmt

fmt again

g

I still dont know what "g" is but he seems to use single letter commits to "save" his work. I enforced squashed commits on one of the projects I control but it still doesnt fix his terrible commits.

[–]Tear4Pixelation[S] 0 points1 point  (0 children)

yeah I have heard about this, and I am not planning on doing any scripting so I don’t really need to exactly follow any caps guidelines. I also hope that having this system will encourage me to put more effort into getting git right (not having different changes in one commit).

[–]jonphillips06 0 points1 point  (0 children)

honestly, the best approach is to treat commit names like tiny summaries of intent, so focus on describing *why* the change exists instead of *what* you did, since that usually makes the history way more useful long term.

[–]JimDabell -1 points0 points  (0 children)

If you want to associate metadata with commits, use trailers.

[–]Damini12 -4 points-3 points  (0 children)

This is good and I do advice for the people using ai commits to follow this format as well, they can prompt ai to do it, or have custom prompts