For the first year or two of using git, I treated it as an undo buffer, with a nice bonus that I could try things out on distinct branches. Commit messages were frequently pro forma, because I wasn't thinking in terms of units of change.
There are still projects I approach this way, "latest firmware" is all I really need if I'm changing things around on my keyboard firmware, for instance.
But with a bit of mentoring several years ago, at a job with expectations for how git should be used, I've come to think of changes to a codebase in terms of a commit. I'm not just writing software, I'm writing a commit on a specific branch.
So writing a commit message doesn't take me out of my flow, because it's part of it: that's what the work was flowing towards. I don't let git drive the work, so there are definitely commits of the form "add $specific-thing\nAlso (minor bugfix/change)", but every time I'm working on a complex project, it's toward a specific commit-sized goal.
I'd love a revision system (probably based on pijul) which created a patch every time I save, which I do every minute or so. With a tool which removed patch lines which never show up in the final diff, and displayed the total change in a way which makes it easy to pick those unrelated changes off into their own patch, so I could break the commit into logical pieces. I wouldn't need it often, but when I'm working on something specific, and I see something else which is wrong, or just easy to change, it would take me out of flow to, idk, write it on a Post-it and do it after the commit is fixed. But commits with unrelated work in them create a sense of creative disorder, one which I would happily take a minute to resolve if the tool made it easy.