As I work more and more with git and GitHub I have become really interested in the version control processes of individuals and teams for developing software.

Git Workflow: Do you commit to master on your solo projects?
dAVE Inden ・ Sep 10 '19
Today, I am wondering about how much change is too much change for a single commit? What do you use to decide when to commit? When is it the right time for you to commit changes?
In developing software we are tasked with a variety of changes or fixes to make to an application. Sometimes it is just a typo or changing the color of a button. Sometimes we are tasked with hunting down a really ugly, difficult to reproduce bug that will take a few days to figure out and solve.
The ability to make commits with git allows us to pull the changes we make out of our application when needed. But, if the change is so drastic it can have serious consequences if the code is removed, especially when other code has come to depend on our changes.
How do you decide you have done enough change to a codebase that you should commit those changes? Is there a point for you when there is too much change for a single commit? How do you make that decision? Do you ever think about what would happen if this commit was rolled back and how the codebase would handle that when you make this decision?
I tend to do a lot of commits. I try to keep each commit focused on a single task. So, for instance, if I need to add error handling to something and improve the output formatting, that's two commits. I would work on one, commit it when it is working, and then work on the next thing. I feel like a commit should be a single, descriptive line and should describe a single code addition or modification. Just my personal approach.