Cleaning up a messy branch

from blog Ned Batchelder's blog, | ↗ original
Let’s say you have a long-lived git branch. Most of the changes should be merged back to main, but some of the changes were already cherry-picked from main, and some of the changes shouldn’t be put onto main at all. How do you review the branch and merge it?Here’s a diagram of a simple example. The main branch at the top has seven commits. ...