Imagine the following future:<p>“Have you linted and unit tested your commit message?”<p>“Junior Developer wanted. 10 years of Conventional Commits experience required.”<p>“Download Conventionalizer! Now you can write Conventional Commits in plain English, having all the syntax automatically generated! (node, erlang OTP and Jerry’s pre-alpha TensorFlow binding library required. Windows support coming soon.)”<p>Something tells me the authors are hard at work solving a problem nobody needs solving.
> feat: a commit of the type feat introduces a new feature to the codebase<p>instead of 'feat:', why not 'feature:'?<p>I dislike partial abbreviation because it is confusing; yes doc for document and max for maximum make sense but in this case feat is literally a different word?
I'm sticking to the GNU ChangeLog format, thanks.<p><a href="https://www.gnu.org/prep/standards/html_node/Change-Logs.html#Change-Logs" rel="nofollow">https://www.gnu.org/prep/standards/html_node/Change-Logs.htm...</a><p>This widely used format gives details about what is being done to each function.<p>This was designed to be used in a ChangeLog file, so it has to be adopted for repository use. We don't have to record the date and name, since that is in the commit meta-data. WE write a commit title, and then the ChangeLog entry becomes the details placed after the blank line. That entry is mandatory: no title-only commits! There can be one or more discussion paragraphs between the title and the ChangeLog entry. We know that these paragraphs aren't ChangeLog entry material because they don't begin with the asterisk.<p>Like this: <a href="http://www.kylheku.com/cgit/txr/commit/?id=b2739251281d7f6ef4d30164101bdf2a8d537a72" rel="nofollow">http://www.kylheku.com/cgit/txr/commit/?id=b2739251281d7f6ef...</a>
We've been following conventional commits for our front end code for the last year or so at my work. In other repositories, we've loosely followed the keep a change log conventions. I find conventional commits great when your repository will produce a package to be consumed by others. For example, conventional commits for our shared JS code helps us produce great change logs and helps us easily follow semver for the NPM packages our other applications use.<p>However, I don't find it that useful in the the final applications, even counter productive, since it typically will take up quite a bit of space in the commit title. Many of our front end devs completely ignore title length conventions now.
For use cases where this level of rigour is desired, it would be nice to have real separate metadata vs. convention. Doing this by convention is unreliable.
I don’t think this is so much to make your commit messages better, as it is to make sure that all of them can be automatically processed into changelog and semver updates.
At $DAYJOB, we organically switched from not having any formal style to having an internal formal style. People seemed to want the benefits of tooling integration and clearer communication.<p>Right now, we are switching SCM's and are looking at adopting Conventional to replace our internal style. I've already started using Conventional and have really appreciated it. It makes it fast and succinct (remember, line length "requirements" in git) to get the information you need even in one-line logs. Also, it makes CHANGELOG maintenance easier, whether using an automated tool or doing it by-hand.<p>Not happy with the other ones, I've created my own commit style validation tool, committed [0] and have deployed it on my open source projects. Like code style enforcement in CI, I like delegating this to a tool since it makes the requirement very clear for contributors.<p>The one thing I'm disappointed with with Conventional is that they did not follow git conventions for multi-line trailers.<p>[0] <a href="https://github.com/crate-ci/committed" rel="nofollow">https://github.com/crate-ci/committed</a>
Isn't wording a bit off? "scope" should describe what the commit <i></i>DOES<i></i>, not what you are personally DOING, and not what you were intended to DO.<p>"body", optionally, describes WHY.<p>Also it feels like more of a convention for a personal project with optional C(I|D) automation prerequisites. In a team there should be a clear and emphasized place for the issue tracking info (ticket number, task id etc etc)
I’ve found the commit message guidelines at <a href="https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project" rel="nofollow">https://git-scm.com/book/en/v2/Distributed-Git-Contributing-...</a> to very helpful for clarity.<p>“ The last thing to keep in mind is the commit message. Getting in the habit of creating quality commit messages makes using and collaborating with Git a lot easier. As a general rule, your messages should start with a single line that’s no more than about 50 characters and that describes the changeset concisely, followed by a blank line, followed by a more detailed explanation. The Git project requires that the more detailed explanation include your motivation for the change and contrast its implementation with previous behavior — this is a good guideline to follow. Write your commit message in the imperative: "Fix bug" and not "Fixed bug" or "Fixes bug."”
I do something like this but for branch names. This spec recommends a squash-merge workflow to turn branches into commits before merge. Why would I wanna do that? It seems like throwing away a lot of detail unnecessarily.
SemVer is generally good practice but I don’t like promotion to religion. For example, during the pre-release of the firebase-functions SDK we shifted SemVer by one: 0.2.1 was a feature addition from 0.2.0 and a breaking change from 0.1.<p>Similarly there are rare cases where I’ve swept breaking changes under the rug because they were severe bug or security fixes that affected a corner case unlikely to be seen in the wild.
Commit messages are just that - an additional communication tool. As long as any format helps keep the understanding within a team clear with a minimum of overhead, so be it.<p>After all the commit message is secondary to the actual code committed.<p>I'm sure everyone can share an episode when a nicely worded commit had to be followed up with an ugly 'Fix a typo' message.<p>The most practical convention is the one that's automated to some degree, for example, issue/feature tag auto-linking or some template driven messages. Either way the message should not become an ultimate hoop to jump before the actual commit and one more thing to 'maintain', the code should be the focus.<p>In my experience, a commit message describing the committed behavior (even when intended) helps tie the code to the overall scope. In case when it's a bugfix, it still must be tied to a correct expected behavior.<p>So in some sense a commit message could serve as an auxilliary level of unit testing. Of course, I'd rather put an effort to enforce the actual practice of unit testing over structuring the commit messages.
We’ve found conventional commits useful in our mono repo. Instead of letting the authors deal with versioning (which sometimes breaks dependencies), our build pipeline determines the semver from the commit messages. This has made it easier to deal with releases for around two dozen packages by developers spread across three different countries.
> <i>When you used a type not of the spec, e.g. feet instead of feat</i><p>This actually had me laughing quite a bit. Because of my love for dad jokes, here are some less conventional commits:<p>"fete" : adding holiday support<p>"braking change" : a change of pace<p>"nix" : removing a featute<p>"suffix" : adding a nice to have
Conventional commits pair nicely with a Lerna monorepo when deploying multiple JS packages at once. Auto-generated changelogs and automatic semver for packages. It's worked well for us over the past year.<p><a href="https://github.com/lerna/lerna/blob/master/commands/version/README.md#--conventional-commits" rel="nofollow">https://github.com/lerna/lerna/blob/master/commands/version/...</a>
prefixes such as "fix: " are better expressed at the bottom of the commit message body.<p>They are metadata, and as such they shouldn't take more attention than the actual data.<p>This matters when you are in a bug hunt in production - you want to find the culprit commit as efficiently as possible, without distractions.
I have a system that creates commit messages automatically. The commit messages themselves are YAML so that they can contain various bits of metadata - current task id, timestamps for oldest/newest known builds associated with that task etc...