How To Clone Only Single Folder Using GIT ?

Abhishek Rawal

Abhishek Rawal

@abhishek-fg9tRh Oct 26, 2024
Consider the repo directory as :
/Main
      /Parent1
         /Child
         /Child2
     /Parent2
        /Child
        /Child2
I only want to clone /Child2 of /Parent2 (i.e /Main/Parent2/Child2). Is it possible with Git ?
I did that using SVN and it worked, but somehow in git it is not possible (or am I missing something ?)

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Jason Estibeiro

    Jason Estibeiro

    @jason-IQjfPQ Feb 24, 2015

    #-Link-Snipped-# - Check this #-Link-Snipped-#.
  • Abhishek Rawal

    Abhishek Rawal

    @abhishek-fg9tRh Feb 24, 2015

    Jason Estibeiro
    #-Link-Snipped-# - Check this #-Link-Snipped-#.
    Here more question arises.
    Can I use two GIT versions together ? Can I maintain two git credentials of two different versions together in single system ?
  • Jason Estibeiro

    Jason Estibeiro

    @jason-IQjfPQ Feb 24, 2015

    Abhishek Rawal
    Here more question arises.
    Can I use two GIT versions together ? Can I maintain two git credentials of two different versions together in single system ?
    Well, I have never really worked on such a scenario but there are 2 commands which may satisfy your answer. One is git submodule and the other is git subtree.

    Submodule is generally used when including an external repository as a library to the current repository/project. This helps in easily pulling updates of the library from the origin. Not really sure what subtree does but it does something similar to submodule but in a different way.