Git conventional commits - communicating with git

Standardized communicating with other devs through git

Intro

We write code not just for machines, but for other humans to read (including future us, who forgot the written code in a year). Software development is a team effort, and therefore it requires communicating what we change and why we change it.

Messaging apps change, and the history of messages is rarely getting preserved. Git always remains to save another commit of code change and the message attached to it. A Git repository is the ultimate source of truth regarding a project. Every cloned git repository is a full decentralized backup of it.

As an example of using Git to its full potential we can traverse for Linux repository to see git commits used as equivalent to emailing.

It is hard writing good atomic commit messages though. It takes some getting used to operating git with best practices.

But how can we ensure that every member will be adhering to such practices? Or even how to remember to do it yourself? The answer is, we can enforce it with linter 😄

Standard v1.0.0

The tool - autogit helps enforcing git conventional commits v1.0.0 standard.

It operates through git hooks of your repository. Once linked, it will enforce itself on git commit at any your Git GUI tool.

you will be encouraged writing commits like that (the tool will prevent commit submitted unless it adheres to the set rules)

<type>(<optional scope>)(optional breaking change '!' char): <subject>
empty separator line
<optional body>
empty separator line
<optional footer key: footer key value>
<optional footer2 key: footer2 key value>

Example of usage

docs: correct spelling of CHANGELOG
feat(api)!: send an email to the customer when a product is shipped
fix: prevent racing of requests

Introduce a request id and a reference to latest request. Dismiss
incoming responses other than from latest request.

Remove timeouts which were used to mitigate the racing issue but are
obsolete now.

Reviewed-by: Z
Refs: #123

How it benefits you?

$ git blame main.go
3e43b5c  (dd84ai 2022-12-10 19:54:42 +0100  1) /*
3e43b5c  (dd84ai 2022-12-10 19:54:42 +0100  2) Copyright © 2022 NAME HERE <EMAIL ADDRESS>
3e43b5c  (dd84ai 2022-12-10 19:54:42 +0100  3) */
3e43b5c  (dd84ai 2022-12-10 19:54:42 +0100  4) package main
3e43b5c  (dd84ai 2022-12-10 19:54:42 +0100  5)
d4745237 (dd84ai 2023-12-10 00:09:35 +0100  6) import (
d4745237 (dd84ai 2023-12-10 00:09:35 +0100  7)  "autogit/interface_cli"
d4745237 (dd84ai 2023-12-10 00:09:35 +0100  8) )
3e43b5c  (dd84ai 2022-12-10 19:54:42 +0100  9)
3e43b5c  (dd84ai 2022-12-10 19:54:42 +0100 10) func main() {
def7cc5c (dd84ai 2023-10-21 23:30:37 +0200 11)  interface_cli.Execute()
3e43b5c  (dd84ai 2022-12-10 19:54:42 +0100 12) }

$ git log 3e43b5c
commit 3e43b5c006406b75afc8ca083262a71c462fd9d0
Author: dd84ai <dd84ai@gmail.com>
Date:   Sat Dec 10 19:54:42 2022 +0100

    chore: init project with GPL license

u can use tools made for git conventional commits standard parsing, that will generate changelogs of changes for product releases! (This feature is available in autogit)

example of generated changelog: changelog example

How can we enforce it for all developers of the repository though?

What makes autogit different?

There are many tools for conventional commits

Autogit is different by having next things:

Summarizing

Getting started with autogit