Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The general idea is to use '<a href="http://schacon.github.com/git/git-filter-branch.html" rel="nofollow noreferrer">git filter-branch'</a> and the following steps:</p> <p>1) Create a submodule using --subdirectory-filter of <code>filter-branch</code> (after cloning your repo). </p> <pre><code>$ git filter-branch --subdirectory-filter ABC HEAD -- --all </code></pre> <p>See this <a href="https://stackoverflow.com/questions/709433/how-can-i-remove-the-unwanted-objects-from-my-repo-after-filter-branch-subdirec">SO question</a> for more on this step.</p> <p>2) Create a superproject using an index filter of <code>filter-branch</code> to delete the submodule. </p> <pre><code>$ git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch ABC" --prune-empty HEAD </code></pre> <p>3) Commit the submodule to the latest version of the superproject.</p> <p>See <a href="https://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository">Detach subdirectory into separate git repository</a> for a practical example.</p> <p>Each submodule will keep its history.<br> But as said in this <a href="http://lists.zerezo.com/git/msg681760.html" rel="nofollow noreferrer">patch proposal</a>, it would:</p> <blockquote> <p>lose all the historical connections between the superproject and the submodule, breaking tools like '<code>git bisect</code>', and making it difficult to recover old releases.</p> <p>Ideally, each version of the newly created superproject would be linked to the correct version of the submodule (and all the .gitmodules entries would be set up correctly, too, throughout the project's history)</p> </blockquote> <p>If you do not need to have previous history linked to the new submodules, you can follow the steps mentioned above.<br> But if you do need to branch from an older point while have references to your submodules (which are currently simple sub-directories), the you could consider trying the script mentioned in the patch I refer to. It is discussed in <a href="http://osdir.com/ml/git/2009-02/msg01861.html" rel="nofollow noreferrer">this thread</a>, but integrated to Git yet, as Junio C Hamano says:</p> <blockquote> <p>Unfortunately, I do not think we have designed fully (nor implemented at all) behaviour to check out different points of history that has the same submodule moved around in the superproject tree.</p> </blockquote>
    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. 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.
    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