如何通过提交消息并剪切文本从git存储库中找到最后的提交?

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

例如,我有诸如以下的提交消息:

Author: System update 0.1.12
...
System update 0.1.09
...
Author: System update 0.0.99
...
System update 0.0.43
...
Author: System update 0.0.1

如何通过提交消息和剪切文本来查找最后的提交-版本?就我而言,我需要找出:

Author: System update 0.1.12

并获取版本:

0.1.12

我可以使用

git log --grep="System update" --pretty=oneline | grep -m1 "System update"

但是我得到了琴弦。我不确定:

grep -m1 "System update"
git commit
1个回答
0
投票

如果您的代码按预期工作,则不能只限制git log显示的提交次数。

git log --grep="System update" -n 1 --pretty=oneline

仅返回我的最后一次提交。

请参见git log

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