|# Stick this in your home directory and point your Global Git config at it by running:|
|# $ git config --global core.attributesfile ~/.gitattributes|
|# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details|
Hi Tekin, I'm loving your Better Git diff output article. I'm definitely going to add your suggestions to my local dev environment!
I've been working a lot with Elixir lately, so I have a suggestion to add to your Gist (i.e. Elixir has 2 possible file formats)
*.xhtml diff=html + *.ex diff=elixir *.exs diff=elixir
Thank you so much for this! I work with rspec and capybara a lot and found using the built-in ruby diff for spec files broke the hunk header entirely for them, so I wrote my own regex for specs based on the native ruby regex:
# .gitconfig [diff "rspec"] xfuncname = "^[ \t]*((RSpec|describe|context|it|before|after|around|feature|scenario|background)[ \t].*)$"
You can then use "rspec" as a diff driver:
# .gitattributes *.rb diff=ruby *_spec.rb diff=rspec