You still create your "clean up" commits, but it's done in a way where git can automatically squash everything back together in the end.
See also https://git-scm.com/docs/git-rebase#Documentation/git-rebase...