How do I download a specific git commit from a repository?

Viewed 41700

I don't have a local code copy/etc, I just want to download a single specific git commit so I can view it. I have the url for the git repository:

git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git

and the commit hash:

ee9c5cfad29c8a13199962614b9b16f1c4137ac9

How can I download just this commit using git (I don't want the whole repo, just the one commit patch)? I have read the man pages for git-pull and git-cherry-pick and fiddled with the commands with no luck.

Cloning the repo really isn't an option because some of the Kernel repositories are exceedingly large and slow to download (hours).

9 Answers

As correctly stated in @Josh Lee answer short answer is not possible.

Nevertheless for not non-real-life situation when you are the owner of big repo and need some commit at new location and save some bandwidth/time to fetch you can create named ref (branch or tag) at specific commit using web-interface and then clone it, eg. if you marked your commit with temp/1 branch:

git clone --branch=temp/1 --depth=1 http://example.com/your-repo

This seems to be the cheapest way (in terms of download size) to fetch some commit provided that you have "create reference" access right to remote repository

Related