Alexandr Panteleev
Alexandr Panteleev

Reputation: 875

Yarn v2 gitignore

I upgraded yarn from v1.22.0 to v2.0.0-rc.29. It generated .yarn folder with:

Should I add whole .yarn folder to .gitignore? Or maybe some nested folders in there like .yarn/cache?

Also, what to do with .pnp.js. Do I commit it, or add to .gitignore

Upvotes: 76

Views: 52635

Answers (1)

Thomas
Thomas

Reputation: 181725

See the Questions & Answers section of the documentation. It has changed several times, so for the most up to date answer just click that link!

But in the StackOverflow spirit of "no link-only answers" here's a snapshot:

Which files should be gitignored?

If you're using Zero-Installs:

.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

If you're not using Zero-Installs:

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

Note that, of the paths you mention, only .yarn/releases should not be in .gitignore.

Upvotes: 102

Related Questions