I want to do something a little more complicated than un-submodule a git submodule
I have a top-level git repo that contains submodule repos.
I want to perform a filter-branch history rewrite on the top-level repo, and essentially incorporate the files from the corresponding submodule version at each commit in the top-level history.
This can also be described as the reverse of Convert a git folder to a submodule retrospectively?
For example,
Submodule repo has history
A--B--C--D
Top repo has history
X--Y--Z
where
X[points to A]--Y[points to B]--Z[points to D]
The naive solution described in the other question would result in:
A--B--C--D
\
> M
/
X--Y--Z
I would like instead:
X'--Y'--Z'
where:
X' is X plus the files from A
Y' is Y plus the files from B
Z' is Z plus the files from D'
Addressing comment from user torek: Note that commit C is lost, and commit D' contains all the changes from commits C and D. This is not by choice, but a simplification. I would also be just as happy with a commit C' (the changes from C) just showing up between Y' and Z', unfortunately that introduces other edge cases that are not worth solving for.
What have I tried so far?
Spent some time trying to articulate what I want to do and researching existing SO questions.
Is this an XY problem?
No, it's not. This is not part of some larger problem that I'm actually trying to solve.