我如何“混淆责任”?删除的行? [英] How do I "git blame" a deleted line?
问题描述
bisect
,但我希望有更便利的方式。 $ b [在你问之前:我只是做了一个 git log -p
并搜索了代码行,(a)一些白痴已经删除了以前的关键代码行 提交和(b)我是那个白痴]
如果您知道该行的内容,这是一个理想的用例for:
git log -S path / to / file
它显示你提交哪个引入或删除该字符串的实例。还有 [ before you ask: in the case, I just did a If you know the contents of the line, this is an ideal use case for: which shows you commits which introduce or remove an instance of that string. There's also the The 这篇关于我如何“混淆责任”?删除的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! -G< regex>
,它对正则表达式做同样的事情!查看 man git-log
并搜索 -G
和 -S $ c
$ b -S
选项或镐(这些功能的友好名称)选项实际上在 git-blame
手册页的标题中提到,在描述部分中,它使用 git log -S来举例说明。 ..
。git blame
is great for modified and added lines but how can I find when a line that existed in a specific previous commit was eventually deleted. I'm thinking bisect
but I was hoping for something handier.git log -p
and searched through for the code line and (a) some idiot had just deleted the vital line in the previous commit and (b) I was that idiot ]git log -S <string> path/to/file
-G<regex>
which does the same thing with regular expressions! See man git-log
and search for the -G
and -S
options, or pickaxe (the friendly name for these features) for more information.-S
option is actually mentioned in the header of the git-blame
manpage too, in the description section, where it gives an example using git log -S...
.