Logically atomic commits

Feb 23, 2020 · 4 min read

When forming a new team (or joining a team for that matter), I always try to get the following item in our code review standards, or ways of working.

Make sure all commits in version control are logically atomic.

What is a logically atomic commit?

A logically atomic commit is the smallest, most meaningful change you can make to the software. It’s big enough to add value, but small enough to be manageable.

It bundles useful changes together essentially.

Let’s walk through a theoretical example. The example change is to a web application and involves the following changes:

Let’s say we have a couple of code reviews from other team members too, for good measure. So you may think that would be 5 commits, the three mentioned above, and 2 code review feedback changes.

This would not produce logically atomic commits.

So, what would be logically atomic?

It would boil down, in my opinion, to the API change.

Why is it important?

As with most things in life, you can absolutely get by without doing the above. However, to move at pace, to have confidence in changes to software, then this is a technique that should be embraced.

If you work in this manner, and rebase/squash/move commits to keep them logically atomic, you can:

Conclusion

Hopefully this post helps explain what a “locally atomic commit” is, and why it’s important to even care about such a thing.

See also