Merge conflicts happen.
With lock files, this can happen if you have different packages (or package versions) installed than in the branch you want to merge.
Fixing the package.json
definition may take some work, but in difficult cases you can work together with the colleague who made the changes in the other branch.
But the yarn.lock
file (or package-json.log
)? Oh my..
It's so long and may have dozens of conflicts for every single conflict in package.json
.
The thing is.. You don't need to fix those merge conflicts yourself.
It is a file that's generated. Not written by a human.
Fixing merge conflicts there is a simple three-step process:
# 1.
rm yarn.lock
# 2.
yarn
# 3.
git add yarn.lock
Replace yarn.lock
with package-lock.json
if you're using npm.
Make your developer life simpler. Don't edit machine-generated files by hand. Simply regenerate them.