When you store third-party dependencies (such as a
vendor folder for Go,
node_modules for npm, or
venv for Python) in your repositories and don’t want changes in the dependencies to show up in your merge requests, you can collapse all diffs for specific folders.
All you have to do is creating a
.gitattributes file with the following content:
vendor with the folder which contains the changes you want to ignore. This is only applied when the
.gitattributes file is already merged in your default branch (e.g.
master). Otherwise, it will still show the diffs in all merge requests!
The disadvantage of this approach is, that it’s not possible to expand the changes manually again, if you want to have a peek inside the changes just for once.