3

I have a Git repository named "test" inside which I have four files and sub-directory named "test2".

So the path would be /test2/file.txt

I would like to pull (remotely) just the sub-directory with all of its content (/test2/file.txt) without cloning "test". Is this possible?

yathrakaaran
  • 179
  • 1
  • 3
  • 15
  • 2
    No, it isn’t possible. – Ry- Oct 04 '14 at 20:42
  • 1
    It's not clear your usage of git terminology is exactly correct. Depending on what you are trying to accomplish `git checkout` may work, or if you have access to the remote directly `git archive` – Andrew C Oct 04 '14 at 20:48
  • Andrew C git archive worked when remotely accessed...thanks for your help. – yathrakaaran Oct 09 '14 at 02:45

1 Answers1

4

Instead of

git clone $URL

you could use

git archive --remote=$URL master test2 -o test2.zip

which would create a zip file containing the content of the test2 folder of the remote master branch.

michas
  • 25,361
  • 15
  • 76
  • 121