如何在git repo的特定状态下显示文件的内容? [英] How can I show the contents of a file at a specific state of a git repo?
本文介绍了如何在git repo的特定状态下显示文件的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在git repo的特定状态下显示由路径给定的文件的内容.我尝试失败了:
I want to show the contents of a file given by a path at a specific state of a git repo. I unsuccessfully tried this:
git show f825334150cd4bc8f46656b2daa8fa1e92f7796d:Katana/source/Git/GitLocalBranch.h
fatal: ambiguous argument
'f825334150cd4bc8f46656b2daa8fa1e92f7796d:Katana/source/Git/GitLocalBranch.h': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
有问题的提交未修改指定的文件.无论文件是否涉及提交,如何在给定状态(由提交哈希指定)下显示文件内容?
The commit in question didn't modify the file specified. How can I show the contents of a file at a given state (specified by a commit hash) regardless of the involvement of the file in the commit?
推荐答案
路径规范可能有问题.
这有效,显示在提交b1b22df407417...
git show b1b22df407417:Makefile
或主分支中的当前版本
git show master:Makefile
或exper分支中的当前版本:
Or current version in exper branch:
git show exper:Makefile
或exper分支上的先前版本:
Or previous version on the exper branch:
git show exper^:Makefile
依此类推
这篇关于如何在git repo的特定状态下显示文件的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文