logoalt Hacker News

lionkortoday at 8:48 AM0 repliesview on HN

That's fair, but that workflow is amateurish at best anyway. You're free to do that, if that's how you work, or if it all gets squashed in the end regardless, but a more sustainable workflow is to make committing itself an explicit part of self-review.

Here's what I do:

`git commit -p`, which basically shows you chunks of changes and you can confirm whether you want to stage those changes. This forces you to briefly review your changes and allows you to select lines or chunks that you don't want to commit (yet).

Then, you have a lot of context, so then its much easier to compose a commit message. Your editor auto-opens at the end of that, so you type in WHY you made the changes (and if you don't know, at least put WHAT you did), save and close the editor, and that's one commit.

If you skip all of this, the commits are less likely to help you later when you need them.