使用 Git 在已删除的文件中搜索
Searching in removed files with Git
我正在尝试在旧版应用中查找提交。提交从代码库中删除了一个 SOAP 服务。我看到未使用的 url 的 属性。提交太多,我还没有设法通过它的消息找到任何匹配项(类似于 "removing..." 或 "get rid of...")。
我想在 Git 历史文件中找到包含某些文本的文件(在我的例子中是 属性 和 url 的用法)。有没有办法用 Git 来做到这一点?
谢谢!
UPDATE 我不需要删除文件名,还需要删除包含文本的文件
来自git log
doc:
-S
Look for differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file. Intended for the
scripter’s use.
It is useful when you’re looking for an exact block of code (like a struct), and want to know the history of that block since it first
came into being: use the feature iteratively to feed the interesting
block in the preimage back into -S, and keep going until you get the
very first version of the block.
git log -S "your-url"
如果你也想要差异
git log -S "your-url" -p
我正在尝试在旧版应用中查找提交。提交从代码库中删除了一个 SOAP 服务。我看到未使用的 url 的 属性。提交太多,我还没有设法通过它的消息找到任何匹配项(类似于 "removing..." 或 "get rid of...")。
我想在 Git 历史文件中找到包含某些文本的文件(在我的例子中是 属性 和 url 的用法)。有没有办法用 Git 来做到这一点?
谢谢!
UPDATE 我不需要删除文件名,还需要删除包含文本的文件
来自git log
doc:
-S
Look for differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file. Intended for the scripter’s use.
It is useful when you’re looking for an exact block of code (like a struct), and want to know the history of that block since it first came into being: use the feature iteratively to feed the interesting block in the preimage back into -S, and keep going until you get the very first version of the block.
git log -S "your-url"
如果你也想要差异
git log -S "your-url" -p