-
Notifications
You must be signed in to change notification settings - Fork 0
When to split commits? #12
Description
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
fixthat requires upgrading a dependency (build) and write - Implement a
fixand realize that a external dependency was rather old, thus upgrade it just in case (build) fixa missing null check and by the way replace all tabs to spaces in the whole file (style).