Some best practices for using Git
deepsource.io
deepsource.io
Squash all commits! No development commits in master branch.
I've seen (and had to help junior devs fix) far more broken branches due to rebase/squash commits than merge commits in git, that I've almost considered finding ways to entirely disable rebase/squash on projects I work on. They are useful tools that I still sometimes use locally during development myself, but I'd much rather see someone's messy laundry in their commit history than a clean history with an accidental merge bomb lurking under the surface where it isn't even obvious a rebase/squash went bad until you've got the regression report and angry users.
In particular, the ability to only stage specific "hunks" at a time (interactive "patch" in the nomenclature of git) can make it possible to "untangle" multiple changes in your working directory into separate commits.
It's important to resist the urge to do push things only on perfection. It works for me.