How to get a copy of an older version of a file in a git repository?

前端 未结 3 373
遥遥无期
遥遥无期 2020-12-23 16:13

I have a version of a .tex file from a number of commits ago that I would like to get a copy of. I have the sha1 hash value for the commit that has the version

3条回答
  •  盖世英雄少女心
    2020-12-23 17:03

    I think that the best solution is to overwrite temporally your file. In your top-level of your repository:

    git checkout  file.tex
    cp file.tex directory
    git checkout HEAD file.tex
    

提交回复
热议问题