Make sure your commits are cohesive to the change you are making. I think that is a good rule of thumb.
On the other hand, some changes are big and messy. In this case I sometimes do intermediate commits, especially if it's at the end of a day just so I can keep yesterdays changes conceptually separate from todays. In the end I may rebase -i the whole thing and clean things up before pushing, but only if there are some obvious and quick ways to split it up.
I do this so I can cherry pick commits into other branches (e.g., fixing a bug in my current branch and merging it back to master).
Other than that, if you felt like you've taken a decently-sized chunk out of whatever problem or feature you're currently working on, commit.