Real work is messy: a debug commit you forgot to remove, a typo fix three commits after the typo. Before you open a pull request, you can tidy all of it.
git rebase -i <base> opens a to-do list of every commit since <base>, oldest first. Edit the list and save, and Git replays it your way:
pick keeps a commit. drop removes it. squash melds a commit into the one above and combines the messages; fixup does the same but keeps only the message above. Reorder lines to reorder commits.
Try it
Clean up the search branch: the debug commit goes, and the typo fix becomes part of the UI commit it fixes.
Commits you haven't changed — here, the first one — are kept as they are. Only what you touched gets rewritten.