git pull from remote... can I pull a specific commit?

70,372

Answer is

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

See Retrieve specific commit from a remote Git repository

Share:
70,372
basZero
Author by

basZero

WORK: Web App Developer, Java Enthusiast since 1995 HOME: I'm in love with photography

Updated on November 25, 2020

Comments

  • basZero
    basZero over 3 years

    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?

  • Jack O'Connor
    Jack O'Connor almost 10 years
    This command only seems to work when I already have that commit hash locally, so it can create a remote reference but it can't seem to fetch anything new. Does it work for anyone else?
  • vitaut
    vitaut almost 10 years
    No, it doesn't work for me either.
  • ocroquette
    ocroquette over 9 years
    It doesn't work if the commit is not already in the repository. It prints nothing but gives back an exit code 1.
  • basZero
    basZero over 6 years
    This works for me and I use it regularly.