<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.brandon-rodriguez.com/index.php?action=history&amp;feed=atom&amp;title=Programming%2FGit_Submodules</id>
	<title>Programming/Git Submodules - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.brandon-rodriguez.com/index.php?action=history&amp;feed=atom&amp;title=Programming%2FGit_Submodules"/>
	<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Programming/Git_Submodules&amp;action=history"/>
	<updated>2026-05-07T12:56:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.brandon-rodriguez.com/index.php?title=Programming/Git_Submodules&amp;diff=451&amp;oldid=prev</id>
		<title>Brodriguez: Brodriguez moved page Git Submodules to Programming/Git Submodules</title>
		<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Programming/Git_Submodules&amp;diff=451&amp;oldid=prev"/>
		<updated>2020-10-25T17:42:44Z</updated>

		<summary type="html">&lt;p&gt;Brodriguez moved page &lt;a href=&quot;/Git_Submodules&quot; class=&quot;mw-redirect&quot; title=&quot;Git Submodules&quot;&gt;Git Submodules&lt;/a&gt; to &lt;a href=&quot;/Programming/Git_Submodules&quot; title=&quot;Programming/Git Submodules&quot;&gt;Programming/Git Submodules&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:42, 25 October 2020&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key dev_wiki:diff::1.12:old-450:rev-451 --&gt;
&lt;/table&gt;</summary>
		<author><name>Brodriguez</name></author>
	</entry>
	<entry>
		<id>https://wiki.brandon-rodriguez.com/index.php?title=Programming/Git_Submodules&amp;diff=450&amp;oldid=prev</id>
		<title>Brodriguez: Create page</title>
		<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Programming/Git_Submodules&amp;diff=450&amp;oldid=prev"/>
		<updated>2020-10-25T17:41:52Z</updated>

		<summary type="html">&lt;p&gt;Create page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Git submodules are essentially git projects that are meant to be used within other projects.&lt;br /&gt;
&lt;br /&gt;
For example, maybe you created a personal library that&amp;#039;s meant to be a helper project for other, larger projects. Or maybe you&amp;#039;re using someone else&amp;#039;s library project, and the programming language doesn&amp;#039;t really have a good way to distribute and download projects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installing Submodules ==&lt;br /&gt;
Submodules can be imported into another project with the command:&lt;br /&gt;
 git submodule add &amp;lt;git_clone_url&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above command will add the submodule directly to the current project root. To specify a subfolder, use:&lt;br /&gt;
 git submodule add &amp;lt;git_clone_url&amp;gt; &amp;lt;relative_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In either case, after adding the project, you&amp;#039;ll need to use the standard {{ ic |git add}} and {{ ic |git commit}} commands.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initializing Submodules ==&lt;br /&gt;
The above commands simply tell your git project &amp;quot;okay, I want you to be able to download this repo on my command, using the current master branch. And this is the location you download it to.&amp;quot; That ensures that anyone who uses your project in the future is able to access the same project, at the same location, with the same code downloaded.&lt;br /&gt;
&lt;br /&gt;
To actually download the submodule, you can do one of two ways:&lt;br /&gt;
1) When you git clone your repo, add the {{ ic |--recurse-submodules}} flag. Ex:&lt;br /&gt;
 git clone &amp;lt;git_clone_url&amp;gt; --recurse-submodules&lt;br /&gt;
&lt;br /&gt;
This will download any submodules currently defined in the project&amp;#039;s master branch, at time of cloning.&lt;br /&gt;
&lt;br /&gt;
2) If the project is already cloned, or the submodules aren&amp;#039;t in the master branch, then select the correct branch and run:&lt;br /&gt;
 git submodule update --init --recursive&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Updating Submodules ==&lt;br /&gt;
To update the current version of code each submodule points to, you can use the command:&lt;br /&gt;
 git submodule foreach git pull origin master&lt;br /&gt;
&lt;br /&gt;
This will check each submodule added to the project, examine each corresponding master branch, and pull changes if there are any.&lt;br /&gt;
&lt;br /&gt;
Once again, to save these changes, you&amp;#039;ll need to use the standard {{ ic |git add}} and {{ ic |git commit}} commands.&lt;/div&gt;</summary>
		<author><name>Brodriguez</name></author>
	</entry>
</feed>