如果我有一个包含最新提交的文件,如下所示:
class A {
String name = "Mary";
}
在特定的提交中,String name = "Mary";
被更改为String name = "Bob"
。问题是,这一行已经被修改了几次(有一次是"John"
,另一个时间是"Adam"
) so git blame
没有用。使用 Git,除了挖掘日志之外,找出包含 String name = "Bob" 行的最后一次提交的最简单方法是什么。
这是我的转到命令 http://kernel.org/pub/software/scm/git/docs/git-log.html
git log -p -S <search term>
更多信息
-p
Generate patch (see section on generating patches).
-S <string>
Look for differences that introduce or remove an instance of <string>.
Note that this is different than the string simply appearing in diff
output; see the pickaxe entry in gitdiffcore(7) for more details.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)