I have a git submodule that I would like to become part of my main project (since I have a lot of project specific code that will go into the submodule).
So I'd like to remove the git references to the submodule and add the files to my main git repository.
But how ?
This is because of some major drawbacks around git submodules, such as being locked to a specific version of the outer repo, the lacking of effective merge management, and the general notion that the Git repository itself doesn't really know it's now a multi-module repository.
Once you have set up the submodules you can update the repository with fetch/pull like you would normally do. To pull everything including the submodules, use the --recurse-submodules and the --remote parameter in the git pull command .
Git submodules allow you to keep a git repository as a subdirectory of another git repository. Git submodules are simply a reference to another repository at a particular snapshot in time. Git submodules enable a Git repository to incorporate and track version history of external code.
You must remove the gitlink entry in your index:
mv subfolder subfolder_tmp git submodule deinit subfolder git rm --cached subfolder mv subfolder_tmp subfolder git add subfolder
Replace subfolder
with the name of the folder for your submodule, and make sure to not add any trailing slash.
This is what I detail in "Remove a Git submodule?" and "un-submodule a git submodule".
The --cached
option allows you to keep the subfolder content in your disk... except git submodule deinit
would already have removed that content anyway. Hence the mv
part.
You then can add and commit that subfolder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With