Search code examples
githubsubdirectorygit-clone

How do I clone someone else's GitHub repo as a subdirectory of my repo?


I would like to add functions from another repo into my repo. To preserve the edit history and licensing info from that repo in the cleanest way, while still building on and modifying that repo to fit into mine, I want to clone it as a subdirectory in my repo.

This has been asked here but I don't see a clean answer in that link. Is there a clean and simple way to do this?


Solution

  • You can use the feature called GitHub submodules which you find a detail description here

    TL;DR

    git submodule add <git@github ...> folder/to/submodule/