I am working on restoring the history of a codebase. I have recovered commits lost at the root of my git repo, and have now discovered a new complication.
A large chunk of code was split into a separate codebase for a while... and then merged back in.
Main repo: A -- B -- C -- D -- E
| ^
Code moved: | |
V |
Other repo: X -- Y -- Z
When the split (and merge) occurred, the files were simply copied into the target repo, and the history was lost.
To complicate matters further, the files were slightly modified on each copy before commit, so it's likely that I will need an extra commit for those changes.
This leads me to two questions:
Will it be possible to replace commit D
(which copies the files back in) with the lower branch (X-Y-Z
)? (This is my priority.)
If that's possible, will it be possible to restore the history of the files created at commit X
as well?
There are around 300 commits on the "other" repo, and around 5000 on the "main" repo from D
onwards.
I suspect git-rebase
is probably required, but ideally, I would like to make use of git-filter-branch
so that I do not have to manually resolve historical merge conflicts.