用pip安装特定的git commit [英] Install specific git commit with pip

查看:229
本文介绍了用pip安装特定的git commit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个django应用程序,我正在使用pip来管理我的需求。我怎么能安装一个特定的git的提交?



在我的情况下,我需要安装此提交:
https://github.com/aladagemre/django-notification/commit/2927346f4c513a217ac8ad076e494dd1adbf70e1

解决方案

您可以指定提交哈希,分支名称,标记。

对于分支名称和标记,还可以安装压缩分配。这更快,更高效,因为它不需要克隆整个存储库。

哈希:

c $ c> $ pip install git + git://github.com/aladagemre/django-notification.git@2927346f4c513a217ac8ad076e494dd1adbf70e1

分支名称



使用git

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

或源码包

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

标记



使用git

  $ pip install git + git://github.com/aladagemre/django-notification.git@v2.1.0 

或从源码包

  $ pip安装https://github.com/aladagemre/django-notification/archive/v2.1.0.tar .gz 



<这是一个没有很好记录的功能,但你可以在 https://pip.pypa.io/en/latest/reference/pip_install.html#git


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

解决方案

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/django-notification.git@v2.1.0

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

这篇关于用pip安装特定的git commit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆