search

Home  >  Q&A  >  body text

How to check the specific content of a file specified in a commit in git?

For example, I want to see the specific content of index.html when 9efcb7c was submitted? Or you can copy this file.

过去多啦不再A梦过去多啦不再A梦2768 days ago893

reply all(4)I'll reply

  • 某草草

    某草草2017-05-02 09:47:10

    git show 9efcb7c:index.html

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-02 09:47:10

    Just go back to this version and then reset it back

    reply
    0
  • PHP中文网

    PHP中文网2017-05-02 09:47:10

    Most tools for or supporting Git can help you achieve this goal quickly, and the effect is also very intuitive. Such as SourceTree or major IDEs.

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:47:10

    It can be easily implemented under git. Based on the hash of that commit you provided, you can run the following command:

    git checkout 9efcb7c

    After running this command, the index.html file at this time is the index.html file at the time of submission (9efcb7c). Then run git checkout master你就可以回到目前的提交状态。
    注意,运行git checkout命令必须保证你当前没有未提交的修改,否则会提示你先将这些修改提交后才能checkout.

    reply
    0
  • Cancelreply