Col*_*ett 15
现在git log支持-L像这样的选项git blame.这是在Git v1.8.4中添加的.
-L <start>,<end>:<file>
-L :<regex>:<file>
Trace the evolution of the line range given by "<start>,<end>" (or
the funcname regex <regex>) within the <file>. You may not give any
pathspec limiters. This is currently limited to a walk starting from a
single revision, i.e., you may only give zero or one positive revision
arguments. You can specify this option more than once.
Run Code Online (Sandbox Code Playgroud)
您可以使用git blame-L选项:
-L <start>,<end>
Annotate only the given line range. <start> and <end> can take one of these forms:
number
If <start> or <end> is a number, it specifies an absolute line number (lines count from 1).
/regex/
This form will use the first line matching the given POSIX regex. If <end> is a regex, it will search starting at the line given by <start>.
+offset or -offset
This is only valid for <end> and will specify a number of lines before or after the line given by <start>.
Run Code Online (Sandbox Code Playgroud)
所以它将如下所示:
git blame -L 40,60 foobar
Run Code Online (Sandbox Code Playgroud)
请注意,git blame显示每行的最新修订版.您也可以尝试使用该--reverse选项:
- 相反
走向历史而不是落后.这不显示出现一行的修订,而是显示一行存在的最后修订版.这需要一系列的修订,如START..END,其中指责路径存在于START中.
http://www.kernel.org/pub/software/scm/git/docs/git-blame.html
你也可以使用
gitk foobar
Run Code Online (Sandbox Code Playgroud)