Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Have you looked into <a href="http://book.git-scm.com/5_submodules.html" rel="nofollow noreferrer">git submodules</a>?</p> <p>I use them for this task. We have a repository of helper classes. However, whenever we make additions &amp; improvements, we want those improvements to be cascaded to all of our projects -- so, we set up that helper repository as a submodule in each project repository.</p> <p>Try the following command from within your repository's root directory:</p> <pre><code>git submodule add ssh://url/to/external/library.git local/path </code></pre> <p>This should do the following steps (taken verbatim from the URL above):</p> <blockquote> <ul> <li>Clones the submodule under the current directory and by default checks out the master branch.</li> <li>Adds the submodule's clone path to the <code>.gitmodules</code> file and adds this file to the index, ready to be committed.</li> <li>Adds the submodule's current commit ID to the index, ready to be committed.</li> </ul> </blockquote> <p>You can then use the</p> <pre><code>git submodule update </code></pre> <p>command to keep things up-to-date.</p> <p>Also, as a side note, if you are doing what I am (e.g. making direct changes to the submodule repository), you need to go to the submodule's root repository directory and commit those changes FIRST before committing the super-project. This is because git keeps track of the versions of the submodules (smart), so if you commit the superproject first, you'll be storing a reference to changes that haven't been committed on the submodule repository. Anyone who tries to clone your superproject will get an error. </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