Make github use .gitattributes "binary" attribute

2020 answer

Generated files like minified JavaScript and compiled CoffeeScript can be detected and excluded from language stats. As an added bonus, unlike vendored and documentation files, these files are suppressed in diffs. generated.rb lists common generated paths and excludes them from the language statistics of your repository.

Use the linguist-generated attribute to mark or unmark paths as generated.

Add into .gitattributes

myfile.csv linguist-generated

I had asked the similar question to Github that

Is there anyway to suppress using .gitattributes the diff of machine generated codes which needs to be versioned and cannot be ignored by using .gitignore file?

The reply from them was

GitHub doesn't use .gitattributes files for choosing which files to show in a diff, so it's not possible to get around this that way.

The only current way to suppress certain files in a diff, is to have the classified as "generated" by Linguist:

https://github.com/github/linguist#generated-file-detection

If you want to do that, you would need to check out the details of how Linguist classifies files as "generated" and make sure that your files qualify. I cannot say whether this is doable for the specific files which you are interested in suppressing from the diff.

So, for now Github does not support .gitattributes file to suppress any diff.

Tags:

Git

Diff

Github