Skip to content

Instantly share code, notes, and snippets.

Last active October 22, 2023 04:48
  • Star 109 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See for more details.
# Stick this in your home directory and point your Global Git config at it by running:
# $ git config --global core.attributesfile ~/.gitattributes
# See for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp
*.cpp diff=cpp
*.hpp diff=cpp
*.cc diff=cpp
*.hh diff=cpp
*.m diff=objc
*.mm diff=objc
*.cs diff=csharp
*.css diff=css
*.html diff=html
*.xhtml diff=html
*.ex diff=elixir
*.exs diff=elixir
*.go diff=golang
*.php diff=php
*.pl diff=perl
*.py diff=python
*.md diff=markdown
*.rb diff=ruby
*.rake diff=ruby
*.rs diff=rust
*.lisp diff=lisp
*.el diff=lisp
# Additional manually-configured matchers you may want to add to your .gitconfig
[diff "rspec"]
xfuncname = "^[ \t]*((RSpec|describe|context|it|before|after|around|feature|scenario|background)[ \t].*)$"
[diff "swift"]
xfuncname = ^[ \t]*((class|func)[ \t].*)$
Copy link

zubin commented Oct 22, 2020

@jimryan Might want to add around too. Thanks!

Copy link

jimryan commented Oct 22, 2020

@zubin Good point! I've updated the snippet above. Thanks!

Copy link

ghost commented Oct 30, 2020

Thank you for a great tip.
I found this gist as well and comment here for additional info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment