git blame -L 40,60 foo
From: Junio C Hamano
- Annotate only the specified line range (lines count from
- 1). The range can be specified with a regexp. For
- example, -L /sub esc_html /,/}$/ limits the
- annotation only to the body of esc_html subroutine.
+ Annotate only the specified line range (lines count from 1).
git blame -L 40,60 foo
Also you can use regular expression to specify the line range.
+git blame -L '/^sub hello {/,/^}$/' foo+
would limit the annotation to the body of hello subroutine.
When you are not interested in changes older than the version v2.6.18, or changes older than 3 weeks, you can use revision range specifiers similar to git-rev-list:
@@ -512,7 +515,7 @@ parents, using commit^! notation: