i probably commit code that doesn't work a handful of times a year, i am extremely anal about keeping the history clean, code can be fixed later but history can't (well, it can, but if someone else uses the repo it's as if you can't)
the way i work is i go through the implementation of a feature, committing as i go, when the code is in a state i am content with, i erase that temporary history, redo it only based on what is in that state (that removes code being added and deleted which is mostly useless in the context of the project's history as a whole) and then push or pr that
and i mean cases where a feature is only partially added in a way such that it doesn't work, or has 5 prs adding random things to a just added feature even though all necessary parts were known from the beginning