A CLI to clone1 a subdirectory of a GitHub repository
npx ghcd@latest [options] <url> [dir]
Open the subdirectory you want to clone in GitHub, and copy the URL. Then run:
npx ghcd@latest https://github.com/vercel/next.js/tree/canary/packages/create-next-app
This will download create-next-app
directory of the vercel/next.js
repository into a new folder.
The https://github.com/
part is optional, so you can also run:
npx ghcd@latest vercel/next.js/tree/canary/packages/create-next-app
You can specify the output directory by passing directory name as the second argument:
npx ghcd@latest vercel/next.js/tree/canary/packages/create-next-app my-copy-of-create-next-app
Initialize a new git repository in the downloaded directory.
Show help.
Footnotes
-
The term clone is used loosely here. π«£ The CLI does not actually clone the repository, but rather downloads the files into a new folder. β©