Git - How to download only a directory


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



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

curl \
  | tar -xz --strip=2  repository/subir/subdir


curl | 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:
<!-- real example -->

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