Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有没有办法获得人头~<;数量>;通过提交git中的哈希和_Git - Fatal编程技术网

有没有办法获得人头~<;数量>;通过提交git中的哈希和

有没有办法获得人头~<;数量>;通过提交git中的哈希和,git,Git,我有一个特别的提交哈希。是否有方法获取此提交的头的“编号”?如果临时标记头,则可以使用git description--contains获取此信息 # make a temporary tag because describe will only use tags git tag tmpXYZ git describe --contains --match tmpXYZ <commit-id> # prints something like tmpXYZ~21, or perhap

我有一个特别的提交哈希。是否有方法获取此提交的头的“编号”?

如果临时标记
,则可以使用
git description--contains
获取此信息

# make a temporary tag because describe will only use tags
git tag tmpXYZ

git describe --contains --match tmpXYZ <commit-id>
# prints something like tmpXYZ~21, or perhaps something more complex

# remove temp tag
git tag -d tmpXYZ
#创建临时标记,因为descripe只使用标记
git标签tmpXYZ
git descripe--contains--match tmpXYZ
#打印类似tmpXYZ~21的内容,或者更复杂的内容
#删除临时标记
git标签-d tmpXYZ

请注意,如果您正在查看的提交不在来自
HEAD
的直接第一父路径上,则可能会得到更复杂的描述,例如(真实示例):
tmpXYZ~64^2~14^2~1
如果您临时标记
HEAD
,则可以使用
git description--contains
获取此信息

# make a temporary tag because describe will only use tags
git tag tmpXYZ

git describe --contains --match tmpXYZ <commit-id>
# prints something like tmpXYZ~21, or perhaps something more complex

# remove temp tag
git tag -d tmpXYZ
#创建临时标记,因为descripe只使用标记
git标签tmpXYZ
git descripe--contains--match tmpXYZ
#打印类似tmpXYZ~21的内容,或者更复杂的内容
#删除临时标记
git标签-d tmpXYZ

请注意,如果您正在查看的提交不在
HEAD
的直接第一父路径上,则可能会得到更复杂的描述,例如(真实示例):
tmpXYZ~64^2~14^2~1

我在苦苦思索一个场景,其中
HEAD~n
比提交id更有用。你想解决的问题更大吗?我在苦苦思索一个场景,
HEAD~n
比提交id更有用。你想解决的问题更大吗?