-->

Install specific git commit with pip

By: Varghese Chacko 1 year, 6 months ago

To install specific git commit with pip,  You can specify commit hash, branch name, tag.

For the branch name and the tag, you can also install a compressed distribution. This is faster and more efficient, as it does not require cloning the entire repository. GitHub creates those bundles automatically.

Hash:

$ pip install git+git@github.com:atemon/django-pagination.git@7aaef508dc57fc292616504d9454585d322b84d5

Branch Name

With git

$ pip install git+git@github.com:atemon/django-pagination.git@cool-feature-branch

From source bundle

$ pip install https://github.com/atemon/django-pagination/archive/cool-feature-branch.tar.gz

Tag:

With git

$ pip install git+https://github.com/atemon/django-pagination.git@v2.1.0

From source bundle

$ pip install https://github.com/atemon/django-pagination/archive/v2.1.0.tar.gz

It is a not well-documented feature, but you can find more information at https://pip.pypa.io/en/latest/reference/pip_install.html#git


If it's a private GitHub repository, you'll need to use:

pip install git+ssh://git@github.com/....

for example:

pip install git+ssh://git@github.com:atemon/django-pagination.git@7aaef508dc57fc292616504d9454585d322b84d5

It's possible to automatically install a python package using the requirements.txt file on you project just by adding the following line:

-e githttps://github.com/atemon/django-pagination.git@branch_or_commit

and run the command line:

$ pip install -r requirements.txt

Wish to hire us?

We take the vision which comes from dreams and apply the magic of science and mathematics, adding the heritage of our profession and our knowledge to create a design.