> I despise squashs. It encourages people to tread git commit as a glorified ^S of their work.
I can’t imagine working with git any other way. Do you hold off committing because you haven’t collected your thoughts enough to craft a good message? What if your editor crashes and you lose your undo history? How do you get back to the last state where the code compiled? If some plan of attack doesn’t work, you just… reset hard and lose it forever?
I can’t count the number of times I’ve done something like the following:
- Try approach A
- Approach A sucks, commit what I’ve done so far, try approach B
- B sucks too, commit again and switch back to A (oh hey, there it is in my reflog!)
- Turns out I need a combination of A and B. Oh hey, a simple git diff shows me the deltas. Awesome!
- Repeat
- Once I’m ready to make the PR, I squash it all, craft a thoughtful, meaningful commit message, look at the commit as if I’m a reviewer, verify it all makes sense in context as a single commit.
(oh and by the end, the commit may be a SINGLE CHARACTER! Precisely what the author of this article is talking about! Is it your contention that every dead-end the author hit should have a permanent place in the repo’s commit history, forever?)
In your world, do you just… not use git at all here? Do you never try approach until you’re sure it’s the right one? You only commit when you have something you want someone else to see? That’s nuts to me. You’re absolutely missing out on some of the best workflow git has to offer.