git checkout feature
git rebase main
git checkout main
git merge --no-ff feature git checkout feature
git rebase main
git checkout main
git merge --no-ff featureI like that this poster is at least thinking about what he wants the history to look like, but you’ll never get it good with a broad rule. It really takes the exercise of rewriting every change you make from a stream of consciousness set of WIP commits into a logical series of incremental patches with clear commit messages. And doing that every time you want to push anything (especially when it is “just” a WIP or feature branch). After a months practice your sense of taste will kick in and tell you if a --no-ff merge seems appropriate for the current chunk of work.
The best part about this workflow is that history remains linear; it is very easy to track the history of changes (since there is never a "branch" with changes on both sides) while at the same time you keep the ability to visualize where the start/end points for a given feature were.
It also works with nested branches! You simply create a new branch2 from your branch1, and then merge --no-ff branch2 to branch1.