After rewriting the history of a repository with git filter-branch
, all the SHAs change.
Now, if that repository (let's call it X
) is used as a git submodule in another repository (let's call it Y
), we have a problem.
Indeed, Y
knows what version of the submodule X
to load based on the SHA of the commit in that submodule. Since all the SHAs in X
have now changed, Y
points to SHAs that no longer exist.
Is there a way to rewrite the history of Y
such that it points to the new commit SHAs of the submodule X
(both in current and past commits)?
I would guess that given a correspondence between old SHAs and new ones, this is possible in principle, but I am afraid it would involve nasty bash scripts.
Is there anything easier?