3

Quick Tip: Hiding changes of specific folders in GitLab merge requests

 1 year ago
source link: https://sj14.gitlab.io/post/2020/04-17-gitlab-nodiff-vendor/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Quick Tip: Hiding changes of specific folders in GitLab merge requests

2020-04-17

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:

1
vendor/* -diff

Just replace 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 for once.

Collapsed Changes

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK