Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ol> <li>You have a project -- call it <strong>MyWebApp</strong> that already has a github repo</li> <li>You want to use the <strong>jquery repository</strong> in your project</li> <li>You want to pull the jquery repo into your project as a <strong>submodule</strong>.</li> </ol> <p>Submodules are really, really easy to reference and use. Assuming you already have MyWebApp set up as a repo, from terminal issue these commands:</p> <pre><code>cd MyWebApp git submodule add git://github.com/jquery/jquery.git externals/jquery </code></pre> <p>This will create a directory named <code>externals/jquery</code>* and link it to the github jquery repository. Now we just need to init the submodule and clone the code to it: </p> <pre><code>git submodule update --init --recursive </code></pre> <p>You should now have all the latest code cloned into the submodule. If the jquery repo changes and you want to pull the latest code down, just issue the <code>submodule update</code> command again. Please note: I typically have a number of external repositories in my projects, so I always group the repos under an "externals" directory.</p> <p>The online <a href="http://www.git-scm.com/book/en/Git-Tools-Submodules">Pro Git Book</a> has some good information on submodules (and git in general) presented in an easy-to-read fashion. Alternately, <code>git help submodule</code> will also give good information. Or take a look at the <a href="https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial">Git Submodule Tutorial</a> on the git wiki.</p> <p>I noticed this blog entry which talks about submodules and compares them to Subversion's svn:externals mechanism: <a href="http://speirs.org/blog/2009/5/11/understanding-git-submodules.html">http://speirs.org/blog/2009/5/11/understanding-git-submodules.html</a> </p> <p><sub>* As a best practice, you should always place your submodules in their own directory, such as Externals. If you don't, your root project directory can become very cluttered very fast.</sub></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload