I need to install with pip from a git hub but wanted the repository from May 4th. Can anyone help me on that?
for instance if I want to pip install a repo's specific branch I can use below command :
pip install https://github.com/user/repo.git@branch
but don't know how get it by date other than branch name?
Well, you can replace <branch> with a desired commit <sha-1>. I've just checked it with bpython:
$ pip install --upgrade --user git+https://github.com/bpython/bpython.git@f2014dbae31313571cc9c26f51a14f4fda09d138
Collecting git+https://github.com/bpython/bpython.git@f2014dbae31313571cc9c26f51a14f4fda09d138
Cloning https://github.com/bpython/bpython.git (to f2014dbae31313571cc9c26f51a14f4fda09d138) to /tmp/.private/alex/pip-tQcJmV-build
Could not find a tag or branch 'f2014dbae31313571cc9c26f51a14f4fda09d138', assuming commit.
...
Another question is how to get a commit for a given date.
The first option is to open a browser, find an appropriate commit and manually form a proper URL for pip install. Actually I used this way for the example above.
But you may want to automate things. I would do a local shallow copy of a given repo from github:
git clone --depth 10 --single-branch --branch master https://github.com/bpython/bpython.git
(take only 10 last commits from master branch of bpython official repo)
Then, determine what commit satisfies the date restrictions:
COMMITID=$(git rev-list -n 1 --before '2016/04/07 16:36:15 2016 +0000' HEAD)
Then, use the commit id in the pip install command:
pip install --upgrade --user git+file:///tmp/.private/alex/bpython@${COMMITID}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With