Cargo Install a Package from a Specific Commit, Branch, or Tag

In Cargo.toml, you’ll just need a little exta config in the desired [dependencies] section.

Installing a package from GitHub has the Cargo.toml config of:

slack = { git = "" }

Along with specifiying the git URI for the package, you may also include a key of branch, tag, or rev (revision; the commit hash). Without any of these (ie, just git), the latest commit on the master branch is used.

Annoyingly, I get a warning in my IDE if I introduce a line break for rev.

slack = { git = "", rev = "d433b65d116c9305844e51f1a45309b6c47e0799" }

If you are using [] syntax, then it should look something like:

git = ""
# Pick one... (rev is commit hash)
branch = ""
tag = ""
rev = ""