[英]How to search through all Git and Mercurial commits in the repository for a certain string?
[英]Search through all git commits with a grep and then format the results
如何使用grep搜索所有git提交,然后僅使用提交哈希和提交注釋來格式化結果。
我已經嘗試過這樣的事情。
git log --pretty=format:%H %N --grep=mysearchtext
不知道我是否在某處缺少一些命令管道。
假設您在談論的是提交消息而不是注釋 ,那么您不想使用%N
。 也許%s
會更好,或者%s %b
會更好。 隨你(由你決定。 另外,請確保將--pretty
標志用單引號或雙引號--pretty
起來,以免被拆分成兩個參數
git log "--pretty=format:%H %s" --grep=mysearchtext
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.