A plan, then the rewrite

You pick the commits. For each one you keep it, reword it, squash it into the one before, or drop it. Git then replays them in that order, and the commits get new SHAs.

Do this while the commits are still only on your Mac. Once other people have based work on them, a rewrite means they have to reconcile their copies.

What you can change

Squash folds a fixup into the commit it belongs with. Reorder puts the setup before the change that depends on it. Reword replaces a message like "wip" with one a reviewer can read. You can also edit a commit's contents and split it.

In gitā

Interactive rebase opens as a sheet that lists the plan before anything runs. Merge, rebase onto another branch, cherry-pick and revert use the same kind of sheet, and a conflict editor when a replay stops.

The page is Merge and rebase.