Straightforward project scaffolding
Clone or download
Latest commit 8d885a9 Mar 14, 2018
Failed to load latest commit information.
src Remove console.log Mar 14, 2018
test add more tests Mar 11, 2018
.eslintrc.json expose API (#23) Sep 2, 2017
.gitignore fix build Sep 2, 2017
.travis.yml add .travis.yml Aug 5, 2017 install sander - fixes #34 Mar 15, 2018
LICENSE initial commit Jul 31, 2017 -> v2.1.0 Mar 12, 2018
appveyor.yml windows support, hopefully Aug 5, 2017 expose API (#23) Sep 2, 2017
package-lock.json install sander - fixes #34 Mar 15, 2018
package.json -> v2.1.3 Mar 15, 2018
rollup.config.js fix build Sep 2, 2017

degit — straightforward project scaffolding

degit makes copies of git repositories. When you run degit some-user/some-repo, it will find the latest commit on and download the associated tar file to ~/.degit/some-user/some-repo/commithash.tar.gz if it doesn't already exist locally. (This is much quicker than using git clone, because you're not downloading the entire git history.)

Requires Node 8 or above, because async and await are the cat's pyjamas


npm install -g degit



The simplest use of degit is to download the master branch of a repo from GitHub to the current working directory:

degit user/repo

# these commands are equivalent
degit github:user/repo

Or you can download from GitLab and BitBucket:

# download from GitLab
degit gitlab:user/repo

# download from BitBucket
degit bitbucket:user/repo

Specify a tag, branch or commit

The default branch is master.

degit user/repo#dev       # branch
degit user/repo#v1.2.3    # release tag
degit user/repo#1234abcd  # commit hash

Create a new folder for the project

If the second argument is omitted, the repo will be cloned to the current directory.

degit user/repo my-new-project

See all options

degit --help

Not supported

  • Private repositories

Pull requests are very welcome!

Wait, isn't this just git clone --depth 1?

A few salient differences:

  • If you git clone, you get a .git folder that pertains to the project template, rather than your project. You can easily forget to re-init the repository, and end up confusing yourself
  • Caching and offline support (if you already have a .tar.gz file for a specific commit, you don't need to fetch it again).
  • Less to type (degit user/repo instead of git clone --depth 1
  • Composability via actions
  • Future capabilities — interactive mode, friendly onboarding and postinstall scripts

JavaScript API

You can also use degit inside a Node script:

const degit = require('degit');

const emitter = degit('user/repo', {
	cache: true,
	force: true,
	verbose: true

emitter.on('info', info => {

emitter.clone('path/to/dest').then(() => {


You can manipulate repositories after they have been cloned with actions, specified in a degit.json file. Currently, there are two actions — clone and remove.


// degit.json
    "action": "clone",
	"src": "user/another-repo"

This will clone the contents of user/another-repo on top of the existing repo. The cloned repo can contain its own degit.json actions.


// degit.json
    "action": "remove",
    "files": [

Additional actions may be added in future.

See also