How do I tidy up my branch before a review?

Rebase onto the target branch, and consider squashing when you merge.

Two things make a branch easier to review, and they are separate decisions.

Bring it up to date

Rebase it onto the branch it is going into. The reviewer then sees your changes against current code rather than against whatever main was last week, and the eventual merge is a fast-forward.

If you have pushed the branch, sending the rebased version needs a force push with lease — safe on a branch only you use, and to be avoided on one someone else has.

Decide what the history should say

If the branch’s commits each do one thing, keep them: a reviewer can read them in order. If they are a record of how you got there — “wip”, “fix”, “actually fix” — a squash merge puts one commit on the target branch and leaves the mess behind.

Squashing at merge time is usually better than rewriting the branch first, because it keeps your working history until the moment it stops being useful.