You've probably noticed that Git puts additional context data in the hunk headers: the lines that start with @@ and specify the line numbers where the hunk fits. For example, in the Rails Git repository, git show 13e7849 reveals the following two lines:
@@ -39,12 +39,7 @@ module ActionController #:nodoc: @@ -67,6 +62,12 @@ module ActionController #:nodoc:
The algorithm Git uses to choose these lines is simple: search backwards for the first line with something other than whitespace in the first column, and use that. This works great for C, but as you can see above, it's not quite as informative when it comes to Ruby. Lucky for us, it can be customized with a two step process.

