Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 374
hurrymaplelad Avatar asked May 03 '13 02:05

hurrymaplelad


People also ask

How do I add a repository to a dependency on github?

To npm install a public project that is hosted on Github, and not the NPM registry, add the Github repo to package. json dependencies using the username/repo#branch-name format. Run npm install and npm will download the project and save it into your /node_modules/ folder.

How do I clone a Git repository branch?

You can clone a specific branch from a Git repository using the git clone –single-branch –branch command. This command retrieves all the files and metadata associated with one branch. To retrieve other branches, you'll need to fetch them later on.

What is reference in git?

A ref is an indirect way of referring to a commit. You can think of it as a user-friendly alias for a commit hash. This is Git's internal mechanism of representing branches and tags. Refs are stored as normal text files in the .git/refs directory, where .git is usually called .git .

How do I see my git repository?

You can find repos in two ways: Type “14ers-git” in the github.com search bar to find the repository.


1 Answers

From the npm docs:

git://github.com/<user>/<project>.git#<branch>  git://github.com/<user>/<project>.git#feature\/<branch> 

As of NPM version 1.1.65, you can do this:

<user>/<project>#<branch> 
like image 186
hurrymaplelad Avatar answered Sep 22 '22 18:09

hurrymaplelad