2014-01-08 102 views

回答

8

只是检查出的旧版本文件:

git checkout HEAD~2 -- path/to/file 

或者更明确:中

git checkout commit-id -- path/to/file 
+1

你使用 - ? –

+0

HEAD〜2是什么意思? –

+1

'HEAD'是当前签出的提交,并且'HEAD_n'在此之前是* nnth * commit。所以这是第二个版本提交之前。 '--'用于告诉Git将剩余的参数作为文件路径处理。 – poke