我试图寻找到一个特定的字符串或任意大写体(例如所有提交foobar
,FooBar
,fooBar
在一个Git仓库)引入/删除.
基于这个SO答案(涵盖了不同的基本用例),我首先尝试使用git grep
git rev-list --all | xargs git grep -i foobar
Run Code Online (Sandbox Code Playgroud)
这非常糟糕,因为它只提供了关于字符串是否存在于提交中的信息,因此我最终得到了大量多余的提交.
然后我尝试了pickaxe
,这让我大部分都在那里,例如
git log --pickaxe-regex -S'foobar' --oneline
Run Code Online (Sandbox Code Playgroud)
这只是小写的foobar
.我尝试了-i
旗帜,但这似乎不适用于该--pickaxe-regex
选项.然后我使用这样的模式,这让我更进一步:
git log --pickaxe-regex -S'.oo.ar' --oneline
Run Code Online (Sandbox Code Playgroud)
有没有办法做--pickaxe-regex
不区分大小写的匹配?
我正在使用git v1.7.12.4.
Von*_*onC 16
-i
与pickaxe一起使用的方式(参见commit accccde,git 1.7.10,2012年4月)是:
git log -S foobar -i --oneline
# or
git log --regexp-ignore-case -Sfoobar
# or
git log -i -Sfoobar
Run Code Online (Sandbox Code Playgroud)
请注意,对于1.x git版本,此选项不适用于正则表达式,只能使用固定字符串.它仅适用于regexp,因为git 2.0和commit 218c45a,git 2.0,2014年5月.
归档时间: |
|
查看次数: |
4356 次 |
最近记录: |