Hidden power of Commit Guidelines
Tags: git, angular, commitizen, guideline
Published: 2020-05-03 10:40:47

In our projects we adapted Commit Guidelines, with more or less standard variation of [Angular Commit Guidelines](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines). It deliver what it promise, 

> This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the change log.

Since we adapt such guidelines, I have discovered one powerful effect on a developer growth.

It's how you start **thinking about code changes** you commit to code base. Following questions starts to bubbling inside your head, 

* Does this change belong to this commit?
* What's clear intent of your changes in?
* What's reasoning and thoughts I can put in message?

And etc.


What happens now is that each commit is representing some **type of change**, with describing clear intent encapsulated inside of commit message. 

Suddenly, you start reading `git log` (yes, for real), and if you need to do comparison between log histories you can do this by simply looking at the titles of commit messages.

Here's one example, 

```
$ git log --pretty="%n    %s" --name-only

    test: has Cancel button, to check both confirm branches

cypress/integration/FunctionalTesting_Suite/CompanyProfilePage/company_profile_page.spec.js

    refactor: move Cancel button to CompanyProfile components

src/components/CompanyProfile/CancelButtonWithConfirmation.scss
src/components/CompanyProfile/CancelButtonWithConfirmation.tsx
src/components/CompanyProfile/CancelButtonWithConfirmationContainer.tsx
src/pages/CompanyProfile/CompanyProfile.tsx

    feat: Employer - Company profile page Cancel button

src/pages/CompanyProfile/CancelButtonWithConfirmation.scss
src/pages/CompanyProfile/CancelButtonWithConfirmation.tsx
src/pages/CompanyProfile/CancelButtonWithConfirmationContainer.tsx
src/pages/CompanyProfile/CompanyProfile.tsx
```

In `git log` you can tell, that I finished feature, did some refactoring, and added integration tests afterwards. That was thoughtful workflow.

Can you tell the same story, by looking at example below?

```
$ git log --pretty="%n    %s" --name-only

    Changed scss

src/pages/CompanyProfile/CancelButtonWithConfirmation.scss

    Add Cancel button

src/pages/CompanyProfile/CancelButtonWithConfirmation.scss

    OK it doesn't work, forgot component. LOL

src/pages/CompanyProfile/CancelButtonWithConfirmation.scss
src/pages/CompanyProfile/CancelButtonWithConfirmation.tsx

    Tests

src/pages/CompanyProfile/CancelButtonWithConfirmationContainer.tsx
src/pages/CompanyProfile/CompanyProfile.tsx
cypress/integration/FunctionalTesting_Suite/CompanyProfilePage/company_profile_page.spec.js

    Is it working yet?

src/pages/CompanyProfile/CompanyProfile.tsx
```

Of course, you may not look at this without crying. You may end up,  shamefully do `git rebase` to squash your commits to hide your crimes of uncertainty. 

---
To start [adopting](https://www.thoughtworks.com/radar/tools?blipid=201911081) commit guidelines, I would recommend to look at this project http://commitizen.github.io/cz-cli/