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
Author by
basZero
WORK: Web App Developer, Java Enthusiast since 1995 HOME: I'm in love with photography
Updated on November 25, 2020Comments
-
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 almost 10 yearsThis 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 almost 10 yearsNo, it doesn't work for me either.
-
ocroquette over 9 yearsIt doesn't work if the commit is not already in the repository. It prints nothing but gives back an exit code 1.
-
basZero over 6 yearsThis works for me and I use it regularly.