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:
Reuse GIT_WORK_TREE in post-receive hook to rm a few files Bower install: No versions available How to get file's relative path in git aliases with parameters? Remote anonymous access to repository denied? Github GET on private repo with access token RStudio: git add --all from the UI
-e git://git.myproject.org/MyProject.git#egg=MyProject -e git+http://git.myproject.org/MyProject/#egg=MyProject -e git+ssh://email@example.com/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.firstname.lastname@example.org#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.