Flow State Flow State

Version control

Committing code

When working on code you will need to commit your changes to the repository. This is a way of saving your changes and making them available to others. It is also a way of keeping track of changes and rolling back to previous versions if necessary.

Key concepts

  1. Commit often and with a clear purpose.
  2. Keep commits small and focused.
  3. Commit messages should follow the Conventional Commits standard.

Commit frequency and size

Commit often to keep your changes small and focused. This makes it easier to review code or rollback to previous commits if necessary.

Commits messages

Well-named commits are essential for long-term project development, making the repository a source of valuable information and change history. Sticking to the established convention in naming commits will speed up the team’s work during code reviews, but it will also be useful for the committer to keep track of the changes they have made.

Conventional Commits

Using Conventional Commits is a great way to create clear history changes. This specification allows you to:

  • Categorise by type (fix, feat, etc.)
  • Keep a structured commit history
  • Automatic changelog generation (optionally)

The commit message consists of three parts described below:

Conventional Commits Scheme

Type communicate intent of changes. Possible types:

  • fix - bug fixes
  • feat - code features
  • build - adding, removing, or upgrading dependencies
  • chore - technical or preventative maintenance including configs and file renames or moves. It’s a type of change that does not affect the content of the source code or tests
  • docs - adding and changing documentation, including readme.md file
  • style - styles updating without changing product functionality
  • test - relating to running tests
  • refactor - refactoring existing code
  • ci - changes to CI or CD configuration
  • remove - removing a feature

Scope is used to tag a package or the module that the commit affects.

Description is the title of the commit. If more detailed information is needed, it should be provided in the <body> of the commit.

Example:

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

To see more information about writing Conventional Commits visit the official specification:

Conventional Commits Conventional Commits

And if you are using VSC download Conventional Commits extention.