DEV Community

Cover image for Replacement for git clone - degit
Vuelancer
Vuelancer

Posted on

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

Top comments (1)

Collapse
 
cenwadike profile image
cenwadike

Thanks for sharing...was really helpful