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>
- 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>
- 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!
Top comments (1)
Thanks for sharing...was really helpful