Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here are two possible solutions:</p> <h3>Submodules</h3> <p>Either copy repository A into a separate directory in larger project B, or (perhaps better) clone repository A into a subdirectory in project B. Then use <a href="http://www.kernel.org/pub/software/scm/git/docs/v1.5.6/git-submodule.html" rel="nofollow noreferrer" title="git-submodule - Initialize, update or inspect submodules">git submodule</a> to make this repository a <strong><em>submodule</em></strong> of a repository B.</p> <p>This is a good solution for loosely-coupled repositories, where development in repository A continues, and the major portion of development is a separate stand-alone development in A. See also <a href="http://git.or.cz/gitwiki/SubmoduleSupport" rel="nofollow noreferrer">SubmoduleSupport</a> and <a href="http://git.or.cz/gitwiki/GitSubmoduleTutorial" rel="nofollow noreferrer">GitSubmoduleTutorial</a> pages on Git Wiki.</p> <h3>Subtree merge</h3> <p>You can merge repository A into a subdirectory of a project B using the <strong><em>subtree merge</em></strong> strategy. This is described in <a href="http://nuclearsquid.com/writings/subtree-merging-and-you/" rel="nofollow noreferrer"><em>Subtree Merging and You</em></a> by Markus Prinz.</p> <pre><code>git remote add -f Bproject /path/to/B git merge -s ours --allow-unrelated-histories --no-commit Bproject/master git read-tree --prefix=dir-B/ -u Bproject/master git commit -m "Merge B project as our subdirectory" git pull -s subtree Bproject master </code></pre> <p>(Option <code>--allow-unrelated-histories</code> is needed for Git >= 2.9.0.)</p> <p>Or you can use <strong>git subtree</strong> tool (<a href="http://github.com/apenwarr/git-subtree" rel="nofollow noreferrer" title="An experimental alternative to the git-submodule command.">repository on GitHub</a>) by apenwarr (Avery Pennarun), announced for example in his blog post <a href="http://apenwarr.ca/log/?m=200904#30" rel="nofollow noreferrer">A new alternative to Git submodules: git subtree</a>.</p> <hr> <p><em>I think in your case (A is to be part of larger project B) the correct solution would be to use <strong>subtree merge</em></strong>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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