Git/Submodules: Difference between revisions
From charlesreid1
(→Notes) |
|||
| Line 42: | Line 42: | ||
===Checking Out Repository with Submodules=== | ===Checking Out Repository with Submodules=== | ||
Start by checking out the repository with the submodules: | |||
<pre> | <pre> | ||
git clone https://charlesreid1.com:3000/rpi/pi-master.git | git clone https://charlesreid1.com:3000/rpi/pi-master.git | ||
</pre> | |||
Initialize the repository submodules: | |||
<pre> | |||
git submodule init | |||
</pre> | </pre> | ||
Revision as of 14:07, 15 January 2018
Notes
I use submodules to organize groups of related repositories and make checking out lots of repos a breeze.
Adding Submodules to Repository
Check out the repository that you want to put submodules into:
git clone https://charlesreid1.com:3000/rpi/pi-master.git cd pi-master
Now add submodules:
git submodule add <git-repo-url>
Here's the script:
#!/bin/bash git submodule add https://charlesreid1.com:3000/rpi/pi-opencv.git git submodule add https://charlesreid1.com:3000/rpi/pi-startup-services.git git submodule add https://charlesreid1.com:3000/rpi/pi-transmission.git git submodule add https://charlesreid1.com:3000/rpi/pi-stunnel.git git submodule add https://charlesreid1.com:3000/rpi/pi-setup.git git submodule add https://charlesreid1.com:3000/rpi/pi-process-wifi-data.git git submodule add https://charlesreid1.com:3000/rpi/pi-join-wifi.git git submodule add https://charlesreid1.com:3000/rpi/pi-aircrack-batch.git
This will add a .gitmodules file automatically.
When you're done, make the commit:
git commit -am 'adding submodules'
Checking Out Repository with Submodules
Start by checking out the repository with the submodules:
git clone https://charlesreid1.com:3000/rpi/pi-master.git
Initialize the repository submodules:
git submodule init
Resources
https://git-scm.com/book/en/v2/Git-Tools-Submodules