A rebase walkthrough with a messy branch
We took a branch with eleven commits, four of them named "fix", and turned it into three commits that each build.
git fetch origin git rebase -i origin/main # squash the fixups into the commit they repair git push --force-with-lease
Use --force-with-lease, never plain --force: it refuses to overwrite work someone else pushed in the meantime.