Let's say I maintain a fork of a project.
I want to perdiodically rebase downstream onto upstream while preserving all the commit SHAs of the changes. That is, I want to rebase each individual merge commit, but I want all the change commits to keep their own parent.
Here's a simplified example, with only one downstream patch.
Initial state:
DOWNSTREAM:
* d9ce4cb Merge branch 'pr1' into downstream # <- our merge commit for the downstream change
|\
| * dcc0f5e (pr1) Downstream commit 1 # <- our change downstream
|/
* ee6faa1 Upstream commit 2
* c57fe05 Upstream commit 1
UPSTREAM:
* 732985e Upstream commit 3 # <- one NEW COMMIT upstream
* ee6faa1 Upstream commit 2
* c57fe05 Upstream commit 1
Now, I run:
$ git rebase --rebase-merges=no-rebase-cousins upstream
I end up with:
ACTUAL DOWNSTREAM:
* e7574a0 Merge branch 'pr1' into downstream
|\
| * 2dc0049 (pr1) Downstream commit 1 # <-- BAD: The downstream commit has changed parent
|/
* 732985e Upstream commit 3
* ee6faa1 Upstream commit 2
* c57fe05 Upstream commit 1
Instead, this is I want (notice that "Downstream commit 1" still has "Upstream commit 2" as a parent, hence it keeps its commit ID):
DESIRED NEW DOWNSTREAM:
* e7574a0 Merge branch 'pr1' into downstream # <- The merge commit has moved
|\
* | 732985e Upstream commit 3
| * dcc0f5e (pr1) Downstream commit 1 # <- GOOD: The downstream commit is preserved
|/
* ee6faa1 Upstream commit 2
* c57fe05 Upstream commit 1
Is there a magic trick to end up in the desired state? (one that ideally works when there are N downstream merge commits to rebase)