git - 通过提交消息标题引用 git commit
问题描述
如何通过提交消息标题中的文本/单词来引用 git 提交?
我想避免:
- 从鼠标复制/粘贴提交哈希
git log
- 输入提交的十六进制数字
解决方案
TL;博士:
引用匹配的最新提交<text>
:
:/<text>, e.g. :/fix nasty bug
<rev>
引用可从该匹配项中获得的最新提交<text>
<rev>^{/<text>}, e.g. HEAD^{/fix nasty bug}
手册页条目
<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>
:
:/<text>, e.g. :/fix nasty bug
A colon, followed by a slash, followed by a text, names a commit
whose commit message matches the specified regular expression. This
name returns the youngest matching commit which is reachable from any
ref. The regular expression can match any part of the commit message.
To match messages starting with a string, one can use e.g. :/^foo.
The special sequence :/! is reserved for modifiers to what is
matched. :/!-foo performs a negative match, while :/!!foo matches a
literal ! character, followed by foo. Any other sequence beginning
with :/! is reserved for now. Depending on the given text, the
shell’s word splitting rules might require additional quoting.
推荐阅读
- javascript - React JS 中的进度条
- tensorflow - 在cnn中查询conv2D层的reg维度
- reactjs - 无法从 React 库 npm 包 (redux) 导入 reducer
- javascript - Maximo 7.6.0.10 自动化脚本错误消息在 Websphere V9.0.5.3 升级后无法正常工作
- java - 删除或搜索数据库时出现奇怪的结果
- unit-testing - 如何使用 gomock (或类似的)来模拟/验证对数据库的调用?
- c++ - StartService FAILED 577 自签名内核驱动程序,如何修复?
- azure-devops - 有没有办法在 Powershell 中创建一个数组并在 Azure DevOps YAML 中循环遍历它?
- javascript - 如何在单击按钮时加载更多页面
- python - Django:使用图片 Exif 数据进行地理编码 - 提示:请安装 `exiftool.`