moe*_*oey 22 regex git command-line
我有一个git存储库,包含数百个提交和几个分支.如何搜索包含某个字符串的特定提交,例如"辅助函数"?理想情况下,字符串可以用正则表达式表示.
kni*_*ttl 22
较新版本的git支持git log -G<regex>
:
git log -G'helper.*function' --full-history --all
Run Code Online (Sandbox Code Playgroud)
它将在每次提交的diff中搜索正则表达式,并且只显示引入了与正则表达式匹配的更改的提交.
moe*_*oey 20
积分转到这个答案:
git log --all --grep='Build 0051'
# case insensitive
git log --all --grep='Build 0051' -i
Run Code Online (Sandbox Code Playgroud)