Git - How to download only a directory

1 - About

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

3 - Example

3.1 - 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


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap