How to create git submodule from repository subdirectory

This tutorial explains how to extract a subdirectory of a git repository and how to make it a submodule or an independent git repository in 8 easy steps.


If you work with


  1. Edward Ortega

    Great help, thx!

  2. plambe

    Does this method preserve the combined history of Project + Library 1 as it used to be in Project? If I go to commit #10 in the Project+Library 1, will it revert to the same files as in the case of commit #10 for the original Project repo?

  3. Shyamkumar L Chauhan

    What is REMOTE_URL in this case ?

    1. Davide Coppola (Post author)

      The IP or url of the remote server hosting the repository of Library1


Leave a Comment

Your email address will not be published. Required fields are marked *