繁体   English   中英

为什么我看不到 git 存储库中已删除的文件?

[英]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

这给了我错误:

fatal: bad revision '^:ranker/knowledge/city_province_map.py'

我也试过:

git show HEAD^:ranker/knowledge/city_province_map.py

但这给出了类似的错误:

fatal: path 'ranker/knowledgw/city_province_map.py' does not exist in 'HEAD^'

我刚才删除了一个文件,我想查看它的内容并将其恢复到存储库。 我在本地机器的 git 项目的根目录下执行了这两个命令。

怎么做?

我怀疑您设置了format.pretty配置,这会影响rev-list 您当然可以使用git config -l | grep format.pretty进行检查git config -l | grep format.pretty

来自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)).

config文档中:

format.pretty
    The default pretty format [...]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM