Am I going to run into any issues if I git clone a repo into an existing git repo?
For sake of simplification, I am developing a library "lib/" that should be available to all of my projects. This is a separate git repo. I'd like to import this lib/ into all of my projects, and update it only in one place, never touch it from any of the projects, just use it.
I am assuming this is ok, just wondered if there is anything I should watch out for. Thanks!
Just for the record, you can clone a git repo within another one: Everything under your lib directory will be ignored by the enclosing Git repo, because said lib directory contains a . git . That means cloning the enclosing repo, and you will get an empty " lib/ " folder.
When you clone a repository, you copy the repository from GitHub.com to your local machine. Cloning a repository pulls down a full copy of all the repository data that GitHub.com has at that point in time, including all versions of every file and folder for the project.
Navigate to the repository you just cloned. Pull in the repository's Git Large File Storage objects. Mirror-push to the new repository. Push the repository's Git Large File Storage objects to your mirror.
Just for the record, you can clone a git repo within another one:
Everything under your lib
directory will be ignored by the enclosing Git repo, because said lib directory contains a .git
.
So it would work, but the enclosing repo would have no idea:
lib
directory from another repolib
to build properly, even though it would record the SHA1 of the nested lib
repo tree. (that is a gitlink, a special entry in the index of the parent repo)lib/
" folder.Those (repo URL and repo SHA1) are precisely the two informations recorded by the parent repo (the enclosing one) in order to reference a submodule.
It is made to give you access to a fixed revision of another repo within your repo, but as explained in "True nature of submodules", that doesn't prevent you to locally modify lib
directly within your parent repo.
(As long as you commit your modifications in lib
first, then go one level up back in your parent repo, and commit there as well)
The main benefit to any contributor of your main project is that, when they will clone said project, they will know they also need lib
if it is declared as a submodule (as mentioned in "Git Submodule Workflow Advice").
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