假设我有一个包含各种提交的 git 存储库,每个提交都修改/添加/删除不同的文件。
我正在寻找一种方法来搜索所有提交的所有文件中的特定字符串。例如,假设我的存储库有两个文件,如下所示,我正在搜索字符串
test
:
1 commit: added file A "file A" does not contain string "test"
2 commit: modified file A "file A" does not contain string "test"
3 commit: added file B "file A" and "file B" do not contain string "test"
4 commit: modified file B "file B" now contains string "test", "file A" not
5 commit: deleted file A "file B" still contains string "test"
6 commit: modified file B "file B" does not contain string "test"
在这种情况下,该命令应返回提交 4 和 5 的 SHA,因为在这种状态下,工作区中存在包含搜索字符串
test
的文件。
这可能吗?我正在直接在 git 中或在 Tortoise git 中寻找解决方案。我已经尝试在Tortoise git的日志中搜索,但没有任何成功,显然,那里的搜索没有搜索到文件内容。