Suppose I have branches A and B with a common ancestor, which have diverged. I want to apply some of the changes on branch A to branch B, but without recording that A has been merged into B, so that if I try to do a "real" merge of A into B I still get the remaining differences.
I can do this by:
- merging without committing
- creating a patch file from the uncommitted changes
- aborting the merge
- applying the patch
- reverting the changes I don't want for now
- committing it as a normal (non-merge) commit
but surely there is an easier way?
Context: I have a base branch (say "main") and a feature branch with many changes on it (say "feature"). I want to create a pull request with only some of the changes on the feature branch, so I create a new branch for that ("pr1"). Eventually the rest of the feature branch will probably be merged into "main", so I don't want to record in git history that all of "feature" has been merged into "pr1", as once that's merged it will look as if all of "feature" has been merged into "main" when it hasn't.
Edit: the changes I want in the PR are not neatly contained in a few commits. There have been maybe a hundred commits on the feature branch, including some merges, and I just want to take the current state of it and submit some of it for review.