DEV Community

Cover image for Replacement for git clone - degit
Vuelancer
Vuelancer

Posted on

11 1

Replacement for git clone - degit

Hey Developers,
When I wanted to clone a specific github repository, I used git:clone and It will result in downloading the entire repository with all branches and git commits.
Few times, I just want to copy(download) some files, branches or folders from a repository (i.e) I don't want the entire tree structure of that repo.

  • I found degit (npm package) to clone a specific branch of the given repository with git commits, other branch details, remote urls.

Cloning repositories using degit

$ npx degit github:user/repo#branch-name <folder-name>
Enter fullscreen mode Exit fullscreen mode
  • master branch is default.
  • folder-name is optional.

Downloading specific folder from a specified branch

$ npx degit github:user/repo/directory/sub-directory#branch-name <folder-name>
Enter fullscreen mode Exit fullscreen mode
  • You can specify any sub-directories appending after /
  • branch-name can be any branch name which has that particular sub-directories in it. (master branch is default).
  • folder-name is optional.

Alternatives to github

  • You can use github, gitlab, bitbucket! For more details, visit the following npm package url!
  • npm-package-degit
  • Thank you!

Support Me

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (1)

Collapse
 
cenwadike profile image
cenwadike •

Thanks for sharing...was really helpful

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more