Skip to content

Habit Building

Habits are not built overnight. If you are just starting to be more intentional about your commit scope and version control habits, consider these tips.

Write down the commit message in advance

A commit message on a post-it note

If you regularly forget to apply scope discipline and to stay within your chosen commit scope, writing down the commit message in advance on a post-it note might help with building intentionality. It forces you to think ahead, even if the result may be more like a forecast rather than a final decision. In some GUI-based Git clients you might even be able to fill the commit message field in advance. When using Git via the CLI you might choose to "echo" the commit message into the console, or you can create an empty commit with a commit message and then "fill" it with amend.

Doing this is not recommended in the long run, but it can help when trying to build new habits.

Start with self-review

Usually self-review happens right before committing, and often is the "last" step of creating a commit. However, if you decided to build better version control habits and be more intentional with your commits, consider focusing on building the habit of self-review first. During the self-review, try to recognize when a different commit scope might have been better in retrospect, or where you may have mixed different scopes together, even if it may be too late (or too much effort) to change it now. It's about continuous improvement, i.e., taking the feedback from the self-review and applying it to the next commit.

Err on the side of smaller commits

Developers who are not intentional about their commit scope tend to create commits that are too large and change too many things. When in doubt, try to create smaller commits and amend or intentionally squash them if they turn out "too small". The more frequently you commit, the more opportunities you get for practicing the habits you are currently focusing on (e.g., self-review) and for practicing the mechanical parts of version control (e.g., amending commits) – even if it means overcorrecting towards "too small" for a while. The best way to replace a bad habit with a better habit may be to overcorrect first and then converge on the sweet spot.