Cargo: Can cargo specify a ref, branch, or tag for a git repository in dependencies section

Created on 6 Jul 2014  ·  10Comments  ·  Source: rust-lang/cargo

Since cargo support directly specify a git repository as dependency. I think specify a ref, branch, or tag for a git repository is an essential requirement.

Most helpful comment

It can indeed!

[dependencies.foo]
git = "..."
branch = "foo"
[dependencies.foo]
git = "..."
rev = "a123456"
[dependencies.foo]
git = "..."
tag = "v0.1.0"

All 10 comments

It can indeed!

[dependencies.foo]
git = "..."
branch = "foo"
[dependencies.foo]
git = "..."
rev = "a123456"
[dependencies.foo]
git = "..."
tag = "v0.1.0"

Sorry for open this useless issue. Thanks for your reply!

@edgarwang maybe github should offer an “official questions” feature.

or alternetively questions like this should be converted to real bugs: “please document the way cargo can specify branches, tags, or revisions in a more visible way”

Tha'ts what Stack Overflow is for.

Is it possible this features only works for GitHub repositories? It fails for me on a BitBucket repository, saying something like "Unable to update https://[email protected]/someone/project.git?branch=branchname"

Edit: I probably have a proxy problem, nevermind.

The URL probably shouldn't include the branch name but rather explicitly specify it in Cargo.toml:

[dependencies]
foo = { git = "https://bitbucket.org/bar/foo", branch = "branch" }

This doesn't seem well documented on the crates website: http://doc.crates.io/manifest.html

For me, this issue is the first hit on "cargo git branch" google search keywords :)
https://www.google.ca/search?q=cargo+git+branch

The feature is talked about here http://doc.crates.io/specifying-dependencies.html#specifying-dependencies-from-git-repositories

I can't find a single mention about pinning to specific commits? Is this done with rev keyword?

@pronebird please ask questions on users.rust-lang.org

(and yes, it's rev)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ehuss picture ehuss  ·  3Comments

dotnetspec picture dotnetspec  ·  3Comments

tensorchen picture tensorchen  ·  3Comments

briansmith picture briansmith  ·  3Comments

alilleybrinker picture alilleybrinker  ·  3Comments