通过提交消息标题引用 git 提交

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

如何通过提交消息标题中的文本/单词来引用 git 提交?

我想避免:

  • 鼠标复制/粘贴来自
    git log
  • 的提交哈希
  • 输入提交十六进制数字
git git-rev-parse git-revision
1个回答
6
投票

TL;博士:

引用与

<text>
匹配的最新提交:

:/<text>, e.g. :/fix nasty bug

引用与

<rev>
 匹配的 
<text>

可到达的最新提交
   <rev>^{/<text>}, e.g. HEAD^{/fix nasty bug}

手册页条目

man gitrevisions
说:

参考从

<rev>
匹配的最新提交:
<text>

引用与 
<rev>^{/<text>}, e.g. HEAD^{/fix nasty bug} A suffix ^ to a revision parameter, followed by a brace pair that contains a text led by a slash, is the same as the :/fix nasty bug syntax below except that it returns the youngest matching commit which is reachable from the <rev> before ^.

匹配的最新提交:

<text>

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