[英]Why can't I see a deleted file from a git repository?
git show $(git rev-list --max-count=1 --all -- ranker/knowledge/city_province_map.py)^:ranker/knowledge/city_province_map.py
This gives me the error:这给了我错误:
fatal: bad revision '^:ranker/knowledge/city_province_map.py'
I also tried:我也试过:
git show HEAD^:ranker/knowledge/city_province_map.py
But this gives a similar error:但这给出了类似的错误:
fatal: path 'ranker/knowledgw/city_province_map.py' does not exist in 'HEAD^'
I have a file deleted a while a ago and I want to see its content and restore it to the repository.我刚才删除了一个文件,我想查看它的内容并将其恢复到存储库。 I executed the two commands at the root directory of the git project in my local machine.
我在本地机器的 git 项目的根目录下执行了这两个命令。
How to do that?怎么做?
I suspect you have the format.pretty
config set, which affects rev-list
.我怀疑您设置了
format.pretty
配置,这会影响rev-list
。 You can check this of course with git config -l | grep format.pretty
您当然可以使用
git config -l | grep format.pretty
进行检查git config -l | grep format.pretty
From the docs for rev-list
:来自
rev-list
的文档:
--pretty[=<format>]
--format=<format>
Pretty-print the contents of the commit logs in a given format, [...]
Note: you can specify the default pretty format in the repository configuration (see git-config(1)).
And in docs for config
:在
config
文档中:
format.pretty
The default pretty format [...]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.