I want pip to install from the latest commit on a master branch of my github repository. I tried many options mentioned here on StackOverflow, none helped. For instance, that does not work:
pip install --upgrade --force-reinstall pathToGithubRepo
Using numpy's repository as an example.
If you know the hash of the commit you are interested in, you can use the following command:
$ pip install -e git+https://github.com/numpy/numpy.git@75b2d5d427afdb1392f2a0b2092e0767e4bab53d#egg=numpy
where 75b2d5d427afdb1392f2a0b2092e0767e4bab53d
is the latest commit for the numpy repository, and numpy
is the project name used by egg for pip to figure out dependencies.
If you want to also automatically get the latest commit hash, you can use the command:
$ git ls-remote [email protected]:numpy/numpy.git | head -1 | awk '{print $1;}'
75b2d5d427afdb1392f2a0b2092e0767e4bab53d
Unix wasn't invented for nothing, let's combine it into one big command:
$ pip install -e git+https://github.com/numpy/numpy.git@$(git ls-remote [email protected]:numpy/numpy.git | head -1 | awk '{print $1;}')#egg=numpy
Replace numpy with your repository url and project name, and you're set.
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