From charlesreid1

Line 53: Line 53:
<pre>
<pre>
git submodule init
git submodule init
</pre>
or, do it all at once:
<pre>
git clone --recurse-submodules https://charlesreid1.com:3000/rpi/pi-master.git
</pre>
</pre>



Revision as of 18:11, 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

or, do it all at once:

git clone --recurse-submodules https://charlesreid1.com:3000/rpi/pi-master.git

Resources

https://git-scm.com/book/en/v2/Git-Tools-Submodules

Flags