2

this question is similar to the one here, but slightly different:

I have a Git repo which has subfolders.

+ main (GIT repo)
  + subdirectory1
     + subfolder1
     + subfolder2

I want to convert subfolder1 and subfolder2 into submodules, but preserve the original folder names of subfolder1, and subfolder2, as well as preserving the history of each subfolder (in its corresponding submodule).

The answer in the linked question shows how to convert the subfolders into submodules (using either filter-branch or filter-repo), but requires renaming the folders that correspond to the new submodules (ie. subfolder1_s).

This is to avoid access/history problems when attempting to checkout any commit older than the submodule refactor. If the names are not changed, GIT tries to revert files within a folder that it no longer has access to, since it is now a submodule. This effectively breaks the entire history up to the point of conversion.

Is there any way to preserve the original folder names AND the GIT history when converting the subfolders to submodules?

I use Git Extensions as development version control GUI.

Juan
  • 21
  • 2

0 Answers0