Git - How to download only a directory

About

This page is about how to download a part of a git repository

Example

curl

Example with curl if you want to download only the directory located at subir/subdir

curl https://github.com/account/repository/tar.gz/master \
  | tar -xz --strip=2  repository/subir/subdir

example:

curl https://codeload.github.com/mui-org/material-ui/tar.gz/master | tar -xz --strip=2  material-ui-master/examples/nextjs-with-typescript
cd nextjs-with-typescript

If the direcrtory is a code project in itself, you can open it with codesandbox. Example:

https://codesandbox.io/s/url
<!-- real example -->
https://codesandbox.io/s/github/mui-org/material-ui/tree/master/examples/nextjs-with-typescript





Discover More
Git - Clone

git clone creates a clone known as local repository from a remote repository. cloning in git means: downloading the remote repository into a newly created directory setting for each downloaded branch...



Share this page:
Follow us:
Task Runner