Install specific git commit with pip

kelwinfc picture kelwinfc · Dec 3, 2012 · Viewed 70.2k times · Source

I'm developing a django app and I'm using pip to manage my requirements. How can I do to install a specific git's commit?

In my case I need to install this commit: https://github.com/aladagemre/django-notification/commit/2927346f4c513a217ac8ad076e494dd1adbf70e1

Answer

Hugo Tavares picture Hugo Tavares · Dec 7, 2012

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/aladagemre/django-notification.git@2927346f4c513a217ac8ad076e494dd1adbf70e1

branch-name

With git

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

or from source bundle

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

tag

with git

$ pip install git+git://github.com/aladagemre/[email protected]

or from source bundle

$ pip install https://github.com/aladagemre/django-notification/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