I've a Xcode project which itself has Git Source Control. In a Libraries folder I've cloned eight other Git project from GitHub. They are located inside my own Git repository and I've added all these libraries to my git in a commit.
Instead of having the code of all these git libraries in my repository, is there a way to let git download their code from their repo when I make a clone of my repo? Or is it normal to include other git repos inside a project?
Create and Manage a Git RepositoryClick on the Settings page for your account, then on the SSH and GPG Keys section. On that page, click the “New SSH key” button. After you have clicked on the New SSH key button a panel will appear in which you should then input a Title for the key and the private key itself.
Sure do the following:
Open your Terminal and execute the following commands
cd /path/to/your/main/repo git submodule add [email protected]:someuser/somerepo.git somerepo git commit -m "Added submodules"
Now instead of copying those files you'll have a reference to the other repository in your project:
Edit:
Now if you want to update the submodule to a more recent commit you can do the following:
cd somerepo git pull # You can also checkout a branch / tag etc. cd .. git add somerepo git commit -m "Telling the main repo to update the reference to the referenced repo"
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