DEV Community

Discussion on: How to Write Useful Commit Messages (My Commit Message Template)

Collapse
 
andrewbrown profile image
Andrew Brown 🇨🇦

Tagging your commits with the associated ticket I think is the most essential part of a git commit.
I do understand that the author is focusing on just the content. So it's just me saying in addition to.

Depending on your size of the commit you may want to consider how verbose a git commit message should be.

I suppose if you squashing multiple commits to merge into a branch you could then be more verbose. I guess this going to depend on your workflow.

No opposition here, just some thoughts.

Collapse
 
jacobherrington profile image
Jacob Herrington (he/him)

Absolutely. I'd say 50% of my commit messages are subject line only, you don't always need a commit message with this much context.

I also think tagging a related issue is critical, but of course, that is assuming your issues are kept up to date! 😉

I don't tend to squash commits when I have a choice. I tend to err on the side of too many commits. Atomic commits have always served me well and I would be afraid to lose some of the benefits by squashing too frequently. 🤷‍♀️

Collapse
 
andrewbrown profile image
Andrew Brown 🇨🇦

I used to work for a startup where one of the co-founders insisted you always have a hyphen between the commit message and the id eg.

#243 - This is my commit message

Pull requests would be halted for this superficial format. A simple hook could have enforced that formating to satisfy the co-founder but they also refused to accept an automated solution.

Insanity!

Thread Thread
 
jacobherrington profile image
Jacob Herrington (he/him)

There is enforcing reasonable processes and rituals, and then there is being picky. ;)