Is it possible to clone only certain commit from a git repo with depth 1?

pip package manager allows installing from various VCS including git:

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://git@myproject.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.git@v1.0#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?

  • Migration from SVN to GIT, suggest, please, repository structure
  • git and django migrations: ignore the migrations files
  • Git error: “Please make sure you have the correct access rights and the repository exists”
  • In Git, how do I configure a hook to run a server-side commands after a commit is accepted?
  • Can TortoiseMerge be used as a difftool with Windows Git Bash?
  • Sharing files across branches in Git
  • 3 Solutions collect form web for “Is it possible to clone only certain commit from a git repo with depth 1?”

    You can neither clone nor 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

    http://git.661346.n2.nabble.com/Fetch-by-SHA-missing-td5604552.html

    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.

    Git Baby is a git and github fan, let's start git clone.