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 @@..@@), 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 #rubydeveloper #rubyonrails #elixir, #python, https://rubyonrails.ba/single/better-git-diff-output-for-ruby-python-elixir-go-and-more

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles