<?xml version="1.0" encoding="UTF-8"?>
<guide>
  <body>&lt;p&gt;&lt;a href=&quot;http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html&quot;&gt;Git Submodules&lt;/a&gt; are actually pretty great. Here&amp;#8217;s a simple way to manage submodule development from within an open source project.&lt;/p&gt;
&lt;p&gt;Say there&amp;#8217;s an Awesome Framework, and you want to write an open source plugin for it.&lt;/p&gt;
&lt;p&gt;First create the plugin.&lt;/p&gt;
&lt;p&gt;(the &amp;#8216;gh&amp;#8217; command comes from the &lt;a href=&quot;http://github.com/defunkt/github-gem&quot;&gt;Github gem&lt;/a&gt;)&lt;/p&gt;
&lt;pre&gt;
$ gh create my-fantastic-plugin
&lt;/pre&gt;
&lt;p&gt;Next clone the framework.&lt;/p&gt;
&lt;pre&gt;
$ gh clone defunkt/my-awesome-framework
$ cd my-awesome-framework
&lt;/pre&gt;
&lt;p&gt;Now add your plugin as a submodule to the framework.&lt;/p&gt;
&lt;pre&gt;
$ gh submodule add git://github.com/defunkt/my-fantastic-plugin.git plugins/my-fantastic-plugin
&lt;/pre&gt;
&lt;p&gt;Next &lt;code&gt;cd&lt;/code&gt; into the plugin and add your private &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; as a remote.&lt;/p&gt;
&lt;pre&gt;
$ cd plugins/my-fantastic-plugin
$ gh remote add push git@github.com:defunkt/my-fantastic-plugin.git
&lt;/pre&gt;
&lt;p&gt;And that&amp;#8217;s it. Make changes from within &lt;code&gt;my-awesome-framework/plugins/my-fantastic-plugin&lt;/code&gt; and, when you&amp;#8217;re ready, just &lt;code&gt;gh push push master&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Best of all: people cloning your &lt;code&gt;my-awesome-framework&lt;/code&gt; fork will have no problem pulling down your &lt;code&gt;my-fantastic-plugin&lt;/code&gt; submodule, as you&amp;#8217;ve registered the public clone &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; for the submodule. The commands&lt;/p&gt;
&lt;pre&gt;
$ gh submodule init
$ gh submodule update
&lt;/pre&gt;
&lt;p&gt;Will pull the submodules into the current repository.&lt;/p&gt;
&lt;p&gt;This is how I develop &lt;a href=&quot;http://github.com/defunkt/textmate.el&quot;&gt;textmate.el&lt;/a&gt; from within my &lt;a href=&quot;http://github.com/defunkt/emacs/tree/master/vendor&quot;&gt;Emacs config&lt;/a&gt; while keeping the submodule &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; public.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://img.skitch.com/20081126-qrn7p5xwmsi65d4sxdt83bc9u7.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Check out &lt;a href=&quot;http://github.com/defunkt/my-awesome-framework&quot;&gt;my-awesome-framework&lt;/a&gt; to see this Guide&amp;#8217;s example in action.&lt;/p&gt;
&lt;p&gt;If you are deploying an application with capistrano and you want to use submodules.&lt;/p&gt;
&lt;pre&gt;
set :git_enable_submodules, 1
&lt;/pre&gt;</body>
  <created-at type="datetime">2008-11-25T18:31:27-08:00</created-at>
  <id type="integer">80</id>
  <permalink>developing-with-submodules</permalink>
  <title>Developing with Submodules</title>
  <updated-at type="datetime">2009-08-18T07:49:26-07:00</updated-at>
  <user-id type="integer">71336</user-id>
</guide>
