How do you resolve git conflicts in yarn.lock
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 installyarn install v1.0.1info 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.
A good approach is detailed in this github discussion about the issue.
git rebase origin/master
When the first conflict arises, I checkout the
yarn.lock
then re-perform the installation
git checkout origin/master -- yarn.lock yarn install
This generates a new
yarn.lock
based on the origin/master version of yarn.lock, but including the changes I made to mypackage.json
. Then it's just a matter of:
git add yarn.lockgit rebase --continue
Instead of rebase i use executable interactive bash script, which fetches only Pipfile.lock Pipfile
#!/usr/bin/env bashexport GIT_TRACE=1git checkout origin/master -- Pipfile.lock Pipfilegit commit -m "fetch to branch Pipfile.lock, Pipfile from origin/master" -- Pipfile.lock Pipfileread -n 1 -p "Do your changes in Pipfile and press Enter ..."pipenv lock --cleargit commit -m "re-apply changes to Pipfile.lock, Pipfile" -- Pipfile.lock Pipfileecho "Done"