Git basics: Conventional commits

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
Search for a command to run...

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
Thank you Rehan, glad you enjoyed it.
Most of you know me for my consistency, a golden arrow in my blog series. I've written 1000 articles in 1008 days! Almost an article a day, and my honeymoon was the only holiday I ever took. I'm super proud of this achievement; it has been a fantasti...

It's not the first time I'll be talking about community. I think it's an essential aspect of any successful tool. This shows in my previous explorations of Astro, Medusa, and now Vendure as well. All these products thrive in a super open, welcoming, ...

The cool part about Vendure is how easy it is to set up and how abstract each layer is. Basically, we get the following elements: External database Server Worker Admin UI Frontend While this is amazing, it also brings a bit of complexity when it co...

The previous article looked at customizing Vendure on a data and process level. In this article, we'll look at customizing emails, as they are often a big part of a webshop system. We'll be looking at two different layers of customization for customi...

Even though Vendure is a pretty significant project out of the box, in some cases, we might want to go in and modify some elements to work to our specific use case. In this article, I'll take a high-level look at some elements we can customize within...

When it comes to writing commit messages, we all get blackouts. It's very hard sometimes to describe a commit message and make it meaningful.
And that's where conventional commits can help you. This is a set of rules to help you describe a commit message.
This is not a golden standard in the industry, some companies use it, and some have their commit structure. Always check with your team what they use.
The basic structure for conventional commits looks like this:
<type>([optional scope]): <short description>
[optional body]
[optional footer]
Let's dive a bit deeper into the meaning of these elements.
type: This is a must-have type. We'll dive into the types in a second.optional scope: A optional flag to indicate an isolated scopeshort description: Your general description for the commitoptional body: A more detailed description of the commit, this is optional but handy for bigger commitsoptional footer: Can state breaking changes and reference issues by ticket numberRight, let's have a look at the types as they are an important aspect here.
build: Changes that affect the build system like gulp, npm, etcci: Changes made to the CI configuration like Travis, Circle, Actionschore: Other changes that don't modify src or test filesdocs: Documentation only changesfeat: A new featurefix: Fixed a bugperf: Code changes that improve performancerefactor: A code change that's not particularly a bug or new featurerevert: Revert a previous commitstyle: Changes to styling like white-space, formatting, semi-colons)test: Add or fix tests Let's look at some samples, as they give the best understanding of what's going on.
In the example below, we see a new feature being introduced. It also states some more details in the body and references a ticket which can be set to #done.
feat: holiday-themed devcard
Our DevCard now features a holiday theme for both Halloween and Christmas!
This also includes a link pointing to Chris' article on how to embed it on your GitHub Profile.
DD-267 #done
Below, you can see a build commit that affects only a specific scope, the extension.
It updates the version to 3.8.0
build(extension): version 3.8.0
The following introduces a breaking change and includes a ! to draw attention to breaking changes.
chore!: drop Node 6 from testing matrix
BREAKING CHANGE: dropping Node 6 which hits end of life in April
This one is a ci issue where we introduce a new Kubernetes helper.
ci: use pulumi common new kubernetes helpers
If you want to read up on some more rules and real-world examples, here are some fantastic resources.
I hope you found this helpful. Conventional Commits helped me make commit messages so much easier and more precise for my team.
Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter