Is it possible to clone only certain commit from a git repo with depth 1?
Pip currently supports cloning over git, git+http and git+ssh:
Ignore local changes in the file and update it on pull Sparse checkout and shallow clone Set static variable from Gradle on build-time git diff two files on same branch, same commit How would you store encrypted information in public DVCS repository? Elastic Beanstack - Rails - git deploy and deploy hooks
-e git://git.myproject.org/MyProject.git#egg=MyProject -e git+http://git.myproject.org/MyProject/#egg=MyProject -e git+ssh://firstname.lastname@example.org/MyProject/#egg=MyProject
Passing branch names, a commit hash or a tag name is also possible:
-e git://git.myproject.org/MyProject.git@master#egg=MyProject -e git://git.myproject.org/MyProject.email@example.com#egg=MyProject -e git://git.myproject.org/MyProject.git@da39a3ee5e6b4b0d3255bfef95601890afd80709#egg=MyProject
This is nice when the package is small, however, it becomes quite slow when the package is huge (e.g. Django). If I need just the last commit of master branch, then I could use
--depth 1 parameter for git clone.
Is it possible to get only a certain commit without the full repo history in general? At least from github?
3 Solutions collect form web for “Is it possible to clone only certain commit from a git repo with depth 1?”
You can neither
fetch from remote a particular commit, much less a depth of 1, due to security reasons: http://thread.gmane.org/gmane.comp.version-control.git/73368/focus=73994
To the best of my knowledge, no. You may want to ask about this on the git mailing list.
You can use GitHub API to get last/any commit: http://developer.github.com/v3/repos/commits/#get-a-single-commit
It’s not a git command, you’ll need to make a HTTP request, parse JSON response and download files with diff-data.