Thankfully, its not only possible to configure a custom regex specific to your language to help Git better orient itself, theres even a pre-defined set of patterns for many languages and formats right there in Git. All we have to do is tell Git which patterns to use for our file extensions.

Source: Better Git diff output for Ruby, Python, Elixir, Go and more - tekin.co.uk

Handy.