Last week I opened a ticket for a bug in the development branch of CakePHP and it got closed as “invalid”. The same happened with tickets from others, too. Later PhpNut wrote in a comment:
[…] the tickets that I closed where invalid because the code was not completed.
Well, I think this approach — committing incomplete and failing stuff — is not optimal, as you no longer know whether an issue (e.g. a fatal error) is a bug or incomplete code (i.e. the developer is aware that it fails).
Hence I think it makes sense to treat every commit as a mini-release, i.e. you always want to deliver a running version to those using the code from the repository. Sure, that’s not always possible, as people make mistakes, but it should be the goal.
The easiest way to accomplish this goal is to have tests: only commit your code if the tests are green. If there are no tests (or not everything is tested) then it helps to move forward with small steps. Make a change, verify it works, commit it. Then repeat these steps.
A nice side effect of such an approach is that it is easier to understand your commits. Instead of one big commit adding for example ten features you will have ten commits adding one feature each.
As you see, one small change in the way you work may bring you quite some benefits :)