【问题标题】:Get content of file in some commit without using `git checkout`在不使用 `git checkout` 的情况下获取某些提交中的文件内容
【发布时间】:2016-06-25 12:07:13
【问题描述】:

有没有办法在某些提交中获取文件的完整内容(不仅仅是差异),而不使用git checkout(因为它会污染工作目录)? 像这样的:

$ git content 43fb721 --file main.rb => "class Main\nend\r"

【问题讨论】:

    标签: git git-commit git-checkout


    【解决方案1】:
    $ git show HEAD~4:main.rb
    $ git show <commit>:<filename>
    

    正是我需要的。

    【讨论】:

      猜你喜欢
      • 2015-12-01
      • 2014-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-05
      • 1970-01-01
      • 2017-03-17
      相关资源
      最近更新 更多