有没有办法获得人头~<;数量>;通过提交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更有用。你想解决的问题更大吗?