4

I create an empty new repository locally, I add a remote repository. Now I want to get a specific commit from the remote repository without downloading the whole remote repository with all its branches!

How do I do that?

basZero
  • 3,868
  • 8
  • 45
  • 84
  • 1
    True, maybe this one: `git fetch origin 96de5297df870:refs/remotes/origin/D-commit` – basZero May 28 '13 at 15:37
  • Why do I get downvotes? The title of the duplicate entry does not contain the word 'git', so I didn't find it! – basZero May 29 '13 at 07:34
  • it doesn't have to, you should use tags in your search. – Jano Jan 14 '14 at 14:01
  • The marked duplicate does not answer my question. It allows to fetch a specific commit, but it also downloads THE WHOLE repository from remote. I clearly asked for a solution where it does NOT DOWNLOAD the whole repo first and then does the fetch of a specific commit. How can I remove the [duplicate] in the title? It's just not true. – basZero Nov 24 '17 at 10:29

1 Answers1

4

Answer is

git fetch origin 96de5297df870:refs/remotes/origin/D-commit

See Retrieve specific commit from a remote Git repository

Community
  • 1
  • 1
basZero
  • 3,868
  • 8
  • 45
  • 84