iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🐙

Hide auto-generated files from GitHub Pull Requests

に公開
2025/06/12

Introduction

When developing with Flutter, it's common to generate files using tools like Freezed, but it's not ideal for these generated files to show up as diffs in Pull Requests.

Hiding Diffs by Default

You can customize the display by creating a .gitattributes file at the root of your project. For Flutter, it's recommended to write it as follows:

.gitattributes
*.freezed.dart linguist-generated=true
*.g.dart linguist-generated=true
```text

This way, files ending in `freezed.dart` will no longer show diffs by default.
![SCR-20220207-dn4](/images/SCR-20220207-dn4.png)

<https://docs.github.com/en/repositories/working-with-files/managing-files/customizing-how-changed-files-appear-on-github>

<https://twitter.com/yamatatsu109_ja/status/1489801580329066498?s=20&t=56etCTKbWUb30V4AJmWtPw>

# Bonus

![SCR-20221230-jsu](/images/SCR-20221230-jsu.png)

When you want to exclude specific extensions or directories to adjust the repository's language statistics, you can use `linguist-vendored`.

```text:.gitattributes
example/** linguist-vendored
GitHubで編集を提案

Discussion