Cloning a Project with SubmodulesIf you pass --recurse-submodules to the git clone command, it will automatically initialize and update each submodule in the repository, including nested submodules if any of the submodules in the repository have submodules themselves.
Use the --mirror Option to Clone All Branches in Git Create an empty directory and navigate to it. Clone your repository with the git clone --mirror command. The --mirror option sets up a mirror of the source repository with all branches.
The idea is to use the git-clone to clone the repository. This will automatically fetch all the branches and tags in the cloned repository. To check out the specific branch, you can use the git-checkout command to create a local tracking branch.
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 .
I have a working git repository containing several submodules (obtained by cloning different repositories).
Now, I want to copy the whole repository (with all the submodules) to a bare git repo on a different machine by either using pushing or cloning. I'm fine loosing the history of the submodules (I'm just interested in keeping their content).
Is this possible ? In my attempts, in the cloned repository the submodule directory is empty.
P.S. I know that this is not the correct workflow (see creating a public repo with submodules), however there is no possibility of updating the original submodule.
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