Depend on a branch or tag using a git URL in a package.json?


Say I've forked a node module with a bugfix and I want to use my fixed version, on a feature branch of course, until the bugfix is merged and released.

How would I reference my fixed version in the dependencies of my package.json?


Solution 1

From the npm docs, using a git URL:<user>/<project>.git#<branch><user>/<project>.git#feature/<branch>

Don't use git:// protocol for GitHub, it is not longer supported

Solution 2

As of NPM version 1.1.65, you can use a shorten github URL:


Create Git branch with current changes

Download a single folder or directory from a GitHub repo