Better Git diff output for Ruby, Python, Elixir, Go and more
The first line (starting @@) is known as the hunk header, and is there to help orientate the change. It gives us the line numbers for the change (the numbers between the @@[email protected]@), but also a textual description for the enclosing context where the change happened, in this example "class TicketPdf". Git tries to figure out this enclosing context, whether it’s a function, module or class definition. For C-like languages it’s pretty good at this. But for the Ruby example above it’s failed to show us the immediate context, which is actually a method called tickets_as_html. That’s because out of the box Git isn’t able to recognise the Ruby syntax for a method definition, which would be def ticket_as_html.What would be more useful is to see:.
Better Git diff output for Ruby, Python, Elixir, Go and more #ruby #rails #rubyonrails #bosnia #programming #tutorials #rubydeveloper #railsdeveloper