Git's commit workflow is backwards, and encourages bad habits
Fixing a typo as you work on something else is not bad - that&#x27;s called Boy Scouting[1] and it&#x27;s totally acceptable to sprinkle small improvements&#x2F;cleanups in a change.<p>As for getting distracted and refactoring something else - you&#x27;re context switching. When you do that, you can also context-switch your repo by stashing your current changes (git stash) while you work on that tangent. Or commit your current changes to their local branch (you&#x27;re liberally using branches, right? Branches are cheap in Git) and switch to a new branch for refactoring.<p>If you really want to write your commit first (which is a great idea, because you should know what changes you&#x27;re planning to make before you start working on them!), then you can create an empty commit when you switch to your new feature branch:<p><pre><code>    git commit --allow-empty
</code></pre>
Write your &quot;plan&quot; as the first commit in that branch. Then do your work, committing frequently, and when you&#x27;re done and squashing your changes into a single commit for review you now have that first commit available and waiting.<p>Most issues I see from people getting confused with their changes and using Git is not using enough branches for their work, not being practiced at branch manipulation, and not being <i>disciplined</i> and intentional about their changes. People aren&#x27;t thinking about &quot;how am I going to release this?&quot; or &quot;how can this be reviewed most efficiently?&quot;, and they get carried away with making a lot of changes at once instead of many small changes.<p>My rule of thumb is that I&#x27;m only allowed to take one step off the path&#x2F;plan, anything else gets put on a todo list to revisit later.<p>Plan the work, then work the plan.<p>[1] <a href="https:&#x2F;&#x2F;www.informit.com&#x2F;articles&#x2F;article.aspx?p=1235624&amp;seqNum=6" rel="nofollow">https:&#x2F;&#x2F;www.informit.com&#x2F;articles&#x2F;article.aspx?p=1235624&amp;seq...</a>