如何解决错误:短SHA1 是不 明确的?

问题描述 投票:0回答:1

我使用git show并收到以下错误,

error: short SHA1 94817b is ambiguous
hint: The candidates are:
hint:   94817b5aaa blob
hint:   94817b8c74 blob
fatal: ambiguous argument '94817b': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

我正在尝试以特定版本的提交获取文件,我从diff对象获得了短提交哈希

git show
1个回答
0
投票
您可以使用git-diff选项告诉--full-index给您斑点的

完整SHA-1而不是缩写版本:

而不是前几个字符,在生成补丁格式输出时,在“索引”行上显示完整的图像前和图像后斑点对象名称。

例如:

git diff --full-index HEAD^..HEAD

将产生一个如下所示的diff头:

diff --git a/path/to/file b/path/to/file index 25c0cfd42393302780668d0f58c6c48333dc1f89..cf913856f0475d360ff45cc244568b53c56a5554 100644

© www.soinside.com 2019 - 2024. All rights reserved.