Skip to content

When to split commits? #12

@javier-godoy

Description

@javier-godoy

In #1 we discussed about multiple purpose commits. The agreement was that multiple purpose commits are not a good practice, based on the following comment from Conventional Commits:

What do I do if the commit conforms to more than one of the commit types?
Go back and make multiple commits whenever possible. Part of the benefit of Conventional Commits is its ability to drive us to make more organized commits and PRs.

In the context of Conventional Commits (which only defines fix and feat), the sentence above amounts to "do not squash two fixes in a single commit, and do not squash a fix and feature in a single commit", i.e. Atomic Commits. [1] [2]

On the other side, since we adopt additional types, the domain of "commits that conform to more than one of the commit types" is now broader. For instance:

  • Implement a feature (feat) and add unit tests (test) for that feature.
  • Implement a feature (feat) that requires adding/upgrading a external dependencies (build).
  • Add external dependencies for general purpose library (build) and implement a feature on top of that framework / general purpose library (feat).
  • Implement a fix that requires upgrading a dependency (build) and write
  • Implement a fix and realize that a external dependency was rather old, thus upgrade it just in case (build)
  • fix a missing null check and by the way replace all tabs to spaces in the whole file (style).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions