How can I hide files in Merge Request Diffs?

I run an auto-generator which we commit to the repo.

Is there a way to hide these files in the Merge request diffs?

The issue Auto collapse diff of generated and less important code tracks such a feature request. We encourage you to vote (:+1:) to help add priority.

You can however achieve a workaround currently through the pre-existing support of .gitattributes files in the root of the repository.

  1. Create a .gitattributes file in the root of your repository
  2. Add an entry (such as the following example) in it, to mark all matching files to be treated as binaries in diff views:
cxx/auto-gen/*.cpp binary
cxx/auto-gen/*.h binary
  1. Commit and push the file to the repository
  2. Try out a new MR with such files changed from your auto-generator