![](/img/trans.png)
[英]Git log - How to list all commits that don't start with a specific word
[英]Filter Git log for commits that don't contain a specific word
如何過濾不包含特定單詞的提交的 git 日志?
我查看了 regexp 站點,並在 Git Bash 中嘗試了一些沒有成功的案例。
您可以使用git log --grep="<your string>"
結合--invert-grep
參數來反轉搜索條件(從 Git for Windows 2.6.2 開始)。
查找提交消息包含字符串foo
的提交:
git log --grep="foo"
查找提交消息不包含字符串foo
的提交:
git log --invert-grep --grep="foo"
您只能以這種方式搜索提交消息,這是通過在簽入中使用-m
標志提交代碼來完成的。 例子:
commit -m "message describing awesome code changes"
這將在日志中保存消息"message describing awesome code changes"
的消息"message describing awesome code changes"
,這意味着搜索單詞awesome
,例如,現在將返回此結果。
您正在搜索的短語/單詞/消息是否可能從未包含在提交消息中?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.