Yes it is. What am I doing wrong?
Yes it is. What am I doing wrong?
If you're intentionally committing code that doesn't work then you are ruining both the ability for others to work with the code, and your own ability to use the history for anything.
You _can_ use it as a poor man's backup solution (I do this myself), but the key then is to have a clear separation between a "work in progress" branch that only you work in, and the collaborative or long-lived branches. Before you merge a work-in-progress branch (or make a pull request), you need to make sure that each commit that remains passes the unit tests. You can use an interactive rebase for this.
But I agree that it is usually best to then "refine" those into nice, working, logical chunks before sharing with others.
Share finished bits of work that help others; keep the snapshot of your messy workshop with the table full of things and tools on a private branch.