Git does not support downloading a specific folder.
But you can achieve this using Github subversion support.
Steps
- Install svn. For example, TortoiseSVN.
- Install SVN extension in Code.
- Open Command Palette in Code (
Ctrl
+Shift
+P
or Cmd
+Shift
+P
) and type svn:checkout
and hit Enter
to run the checkout command.
- Enter the path of the Git folder you want to download replacing the path's
tree/master
part with trunk
as shown here.
For example, if you want to download the packages folder in the vue-next repository, https://github.com/vuejs/vue-next/tree/master/packages
will be the Github URL for the folder.
Replace the tree/master
part with trunk
: https://github.com/vuejs/vue-next/trunk/packages
. This will be your SVN checkout path you'll enter in the svn checkout dialog in Code.
- Select a local repository location to checkout.
This is probably too much for downloading a folder. But writing this as you wanted a way to download a folder from Code itself.
I didn't find any Code extension that could achieve this directly.
And I personally think that Mikaal Anwar's solution is a better one if you want to do it from a browser instead of from VSCode.
Reference:
https://stackoverflow.com/a/18194523/4453794