Is there any git command to fetch an intermediate commit, just like 'svn co -r xxx' works? Thanks!
Asked
Active
Viewed 1.1k times
8
-
http://stackoverflow.com/questions/14872486/pull-a-specific-commit-from-a-remote-git-repository – Ciro Santilli OurBigBook.com Aug 10 '15 at 08:22
1 Answers
13
git checkout <commit-id>
, where <commit-id>
is the SHA1 of a commit, a tag, or a branch.
Note that in git vocabulary, fetch
refers to connecting to a remote repository and grabbing its commits.

CharlesB
- 86,532
- 28
- 194
- 218
-
Thanks! So, is it possible checkout a specified folder to that commit, but leave others unchanged? – pengguang001 Apr 28 '11 at 13:50
-
2@soul2003: well, you can - e.g. `git checkout
-- tests/` will revert your working tree (and the staging area) for the `tests` subdirectory to the state at ` – Mark Longair Apr 28 '11 at 14:01`. However, asking that question raises the larger one of "what problem are you really trying to solve?" - I suspect that's not what you really want to do... -
2@soul2003: I find "can you x?" questions in git easiest to look up in the [visual git reference](http://marklodato.github.com/visual-git-guide/index-en.html). – jtniehof Apr 28 '11 at 14:09