Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you resolve git conflicts in yarn.lock

When multiple git branches modify the dependencies in a project that uses Yarn, it is likely to introduce a conflict in the yarn.lock file. It is not a good idea to delete and regenerate the yarn.lock file because this will probably cause several packages to be unintentionally upgraded. What is the best way to quickly resolve conflicts in this file?

like image 962
Christian Schlensker Avatar asked Mar 21 '17 22:03

Christian Schlensker


People also ask

How do you resolve conflict in yarn locks?

When multiple Git branches modify the dependencies in a project that uses Yarn, it is likely to introduce a conflict in the yarn. lock file. It is not a good idea to delete and regenerate the yarn. lock file because this will probably cause several packages to be unintentionally upgraded.

What is a git conflict and how are they resolved?

If Developer A tries to edit code that Developer B is editing a conflict may occur. To alleviate the occurrence of conflicts developers will work in separate isolated branches. The git merge command's primary responsibility is to combine separate branches and resolve any conflicting edits.


Video Answer


1 Answers

Since Yarn 1.0 it's easy because it has built in support for this scenario.

First solve the conflict in package.json manually, then just run this:

$ yarn install  yarn install v1.0.1 info Merge conflict detected in yarn.lock and successfully merged. [1/4] Resolving packages... 

And then the conflict will be resolved and you can commit that or continue rebasing if that was what you were doing.

like image 130
Vanuan Avatar answered Sep 29 '22 18:09

Vanuan