<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Blair Vanderlugt</title>
    <description>The latest articles on DEV Community by Blair Vanderlugt (@bvanderlugt).</description>
    <link>https://dev.to/bvanderlugt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F467130%2F6bde8a04-a866-4285-bfe4-24fdedaf0dfe.jpeg</url>
      <title>DEV Community: Blair Vanderlugt</title>
      <link>https://dev.to/bvanderlugt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bvanderlugt"/>
    <language>en</language>
    <item>
      <title>Demystifying Git Submodules</title>
      <dc:creator>Blair Vanderlugt</dc:creator>
      <pubDate>Mon, 14 Sep 2020 01:23:09 +0000</pubDate>
      <link>https://dev.to/bvanderlugt/de-mystifying-git-submodules-5ede</link>
      <guid>https://dev.to/bvanderlugt/de-mystifying-git-submodules-5ede</guid>
      <description>&lt;h2&gt;
  
  
  If you are working with Git submodules for the first time they may catch you off guard with their behavior.
&lt;/h2&gt;

&lt;p&gt;Where are the submodules files after cloning? Why do they show changes when I ask git for status? Let's dig into the docs and figure out how to get started working with Git Submodules. &lt;/p&gt;

&lt;p&gt;First, what are these submodules and why would I use them?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It often happens that while working on one project, you need &amp;gt;to use another project from within it. Perhaps it’s a library &amp;gt;that a third party developed or that you’re developing &amp;gt;separately and using in multiple parent projects. A common &amp;gt;issue arises in these scenarios: you want to be able to treat &amp;gt;the two projects as separate yet still be able to use one &amp;gt;from within the other.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The two tricky things you can encounter when you are first working with submodules are: initializing the submodule and pulling upstream changes.&lt;/p&gt;

&lt;p&gt;When you first pull down a git repository containing submodules you will not actually get the submodule files with the clone. Kinda weird right? To get the files you can run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git submodule update --init
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The "--init" command will populate the submodules with their respective git commit's. &lt;/p&gt;

&lt;p&gt;The next hang up you might run into is when you pull down a branch an upon running "git status" you see that the submodules are modified with the message "(new commits)". This means your local branch does not contain the changes from upstream. To pull these run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git submodule update
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;That should be enough to get you started working with Git submodules. For more information visit the &lt;a href="https://git-scm.com/book/en/v2/Git-Tools-Submodules"&gt;Git Man page&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
    </item>
  </channel>
</rss>
