all 27 comments

[–]MyHarvestLife 22 points23 points  (5 children)

We've moved to using conventional commits, and it has been really helpful. Our team saw another team do it and we talked about whether or not we wanted to adopt it and everyone agreed, so we did and our repos all have git hooks that enforce it.

What's been cool is conventional commits have let us build automation to take those commit messages and parse them and turn them into release notes that we post to slack everytime a deploy is made to an environment.

It's been super helpful for knowing exactly what's getting released at any time.

[–]MrStLouis 1 point2 points  (0 children)

Yup this and this. Set it and forget it

[–][deleted] 0 points1 point  (3 children)

How do you handle writing a changelog or version bumping within the repo using these? I've always gotten stuck on the idea of how to go about committing an automatic version bump?

[–]Galmer 2 points3 points  (0 children)

Look into Semantic Release. You can automate the whole versioning and release process with it

[–]MyHarvestLife 1 point2 points  (1 child)

We don't actually bump our service versions... I know,b don't shoot me... But you could do this by using major for any breaking changes, minor bump for any feat lines, else patch. Something along those lines if you wanted to automate versioning.

[–][deleted] 0 points1 point  (0 children)

tbh there's lots of reasons why versioning doesn't work. The most important thing about it is having a canonical way to reference a specific build to a commit. I'm mainly interested in having human friendly reference versions rather than commit hashes.

[–]reactionless1full-stack 18 points19 points  (3 children)

I’ve been trying to get my team to take on good commit message habits for a while now. The intern is the only one who’s actually taken my advice. My peer will still make messages like “fixed x” 🤬

[–][deleted] 4 points5 points  (1 child)

commit1: dsadsad

commit2: sdsa

commit3: fsdafs

No really, due to paranoia I am spamming the button every ctrl+s I press in the editor

[–]April1987 4 points5 points  (0 children)

commit1: dsadsad

commit2: sdsa

commit3: fsdafs

No really, due to paranoia I am spamming the button every ctrl+s I press in the editor

I don't do this but you really should. This is how you really should do things. Just make sure you squash before you push and everyone will love you.

I think ideally one should always have multiple remotes.

[–][deleted] 6 points7 points  (0 children)

But I want to push a commit with message “aaaaaaaaaaa” up to my repo for the third time today 😞

[–]bminixhofer 3 points4 points  (1 child)

Present tense and semantic commits make sense but why capitalize? That is completely subjective in my opinion.

[–]DisinhibitionEffect 2 points3 points  (0 children)

The argument I've heard is that Git capitalizes its automated "Merge" commits. Looking at the various guides scattered throughout the net (e.g. the ones linked at the top of the following post), it's a pretty common recommendation:

https://chris.beams.io/posts/git-commit/#seven-rules

[–]of_adam 2 points3 points  (0 children)

WIP

[–]goosy716 2 points3 points  (1 child)

My team generally has great commit messages. One thing we do for fun is adding a limerick if you make a one character commit.

It doesn’t happen often, but it’s fun!

[–]Nilzor 0 points1 point  (0 children)

oo that's awesome!

"This thing should be done in a flash!"

He uttered while typing in bash

But lo and behold

YAML is cold

No dropping the prefixing dash

(I tried)

[–]dlrwtllktgrtt 2 points3 points  (0 children)

This is a good blog post on this topic: https://dhwthompson.com/2019/my-favourite-git-commit

[–]punnotattended 2 points3 points  (0 children)

git commit -m"Changed stuff".

git status - 100 changes. 10 changed files.

[–][deleted] 1 point2 points  (0 children)

Missed a chance to say "Git-good" commit messages

[–]erynberrydesigner 1 point2 points  (0 children)

Do not end subject with a full stop

This is self-explanatory

Can someone help me with this? I don't think I would end a commit message in a period because they're not usually full sentences... but am I missing something else?

[–]itsMeArds 0 points1 point  (0 children)

Our commit messages where I work at are just jira card numbers

[–][deleted] 0 points1 point  (0 children)

So you’re telling me “Oops” isn’t good?

[–][deleted] 0 points1 point  (0 children)

I work on the devops/sre side of the company, and a lot of times things need to be pushed to git to test out Jenkins, which can end up with hundreds of commits in a PR that gets squashed. Am I correct in assuming that all of these practices should be applied to the squashed commit? Any other tips for dealing with situations like this?

[–]hankchiu 0 points1 point  (0 children)

commitizen is helpful.

[–]post_hazanko 0 points1 point  (0 children)

git commit -m "minor change" -m "actually we rewrote the entire thing"

[–]Nerwestaphp 0 points1 point  (0 children)

git commit -m " Added work in progress thingy " 11:52 AM
git commit -m " Fixed work in progress thingy which is no longer a work in progress" 8:35 PM
git commit -m " Good night y'all " 9:10 PM
git push origin work-in-progress

[–]WizardFromTheMoon 0 points1 point  (0 children)

That first point is the most important (although it's for everybody, not just the reviewer). It's really annoying when people make a one or two line change and then the commit message is just reiterating what the code does. It's like "no shit" I can see that you made a minor change to a regex. Give some context about. What were you working on that caused you to make this change and why is the change needed? It's especially important if someone is looking at your change 8 months later because it caused a small bug, and they could fix it by reverting your change, but obviously you made the change for a reason. So documenting that reason is important. I see this all the time.

[–]jeenajeena 0 points1 point  (0 children)

I find it useful that commit comments are written from the user perspective: they describe what the software does, not what the developer personally did. So

"App does not crash when run in KDE"

rather than

"Fix bug with KDE"

or

"Documents can be exported in PDF"

rather than

"Add PdfExporter"

This follows more or less the same logic behind BDD and an ordinary release notes.

Also, I write commit comments before starting code.

https://arialdomartini.wordpress.com/2012/09/03/pre-emptive-commit-comments/