你如何解决yarn.lock中的git冲突 [英] How do you resolve git conflicts in yarn.lock

查看:257
本文介绍了你如何解决yarn.lock中的git冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当多个git分支在一个使用Yarn的项目中修改依赖时,很可能会在yarn中引入冲突.lock 文件.删除并重新生成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?

推荐答案

自 Yarn 1.0 以来很简单,因为它内置了对这种情况的支持.

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

先手动解决package.json中的冲突,然后运行这个:

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.

这篇关于你如何解决yarn.lock中的git冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆