[英]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.