Download with Git
You can't do it. Unlike Subversion, where each subdirectory can be checked out individually, Git operates on a whole-repository basis. For projects where finer-grained access is necessary, you can use submodules -- each submodule is a separate Git project, and thus can be cloned individually.
But if a project wasn't configured so from the beggining, you're not able to do it.
To download a folder, we are not going to use Git, we are going to use SVN instead, yes ! Subversion will do the trick for you, just follow the following steps (you need to have svn installed on your machine and svn environment variable needs to be available in the command prompt):
1) If you are a windows user
In your windows command prompt, if an alert says that svn is not defined, you need to declare a environment variable with the following value in the System Environment Variables, go to control panel > system and security > system > Environment variables > new
Name of variable : svn ##The path may vary, you need to give the path to TortoiseProc.exe in your desktop Value of the variable : C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe
Now we are going to simply use the
svn checkout command from the command prompt, in this example, we are going to download the following folder from a xamarin repository. This repository has too many things that i don't need, and i cannot download a .zip file from this folder, therefore we are going to use subversion to clone only this folder.
Now, the svn checkout command will expect :
# svn checkout
svn checkout "https://github.com/xamarin/xamarin-forms-samples/tree/master/Todo"
But if you try to checkout with the normal URL, svn will not found any repo there. To fix this, you only need to replace tree/master from the url and replace it with trunk.
Finally, try executing the previous command with the final url :
svn checkout "https://github.com/xamarin/xamarin-forms-samples/trunk/Todo"
And everything should be now located in the folder where you executed the command.
- If you use
svn export <url>instead of
svn checkout <url>, you'll get a clean copy of the folder without extra git repository files.
svn ls <url>to list all available tags and branches before downloading if you want.