As an experienced engineer, I struggle with the commit cadence and find it is a personal development style - others might commit more or less frequently than I do.
As mentioned, break up your features or tasks into branches. Commit often on your local/remote branch at crucial save points or to mark work in progress with commit messages that at are short but to the point.
When you are ready for a pull request and to merge to master, git rebase is your friend. This command allows you to squash your mini commits into a one nicely worded and descriptive commit about the changes you have made.
A fellow engineer at Spreedly has a great blog post on commit messages
So true! Sometimes it helps me to git commit -m "wip" after every tiny change and then git rebase -i [branch] once I'm done — this way you can undo every single change in case you fuck up somewhere along the way and after you're all done you can squash the witty wips into one coherent, well-explained message (and nobody will ever know that you broke everything three times in the process)
git commit -m "wip"
git rebase -i [branch]
We’re a place for programmers to stay up-to-date, learn new skills, and share ideas.
We’ll never post without your permission.