TL;DR :
I want to avoid conflicts each time I'm merging my bumped base project package.version in the forked one containing a different package.name.
Issue :
Context
I maintain two git repos, named here base
and fork
, each contains a shared package.json
and the package-lock.json
accordingly. They got a propert name
to base
and base_fork
respectively, the second has been updated since the first commit after forking. Each lives in gitlab context and the second is created with the fork option of gitlab.
Workflow
A version bump happen in base
, I update the lockfile with an npm i
then push to base
master branch. I'm starting a merge request with gitlab from base
master to fork
master. This one fail due to conflict that I need to resolve manually in package.json
and package-lock.json
:
<<<<<<< HEAD
"name": "fork",
"version": "1.0.0",
=======
"name": "base",
"version": "1.0.1"
>>>>>>> xxxxxxxx
So, I'm taking name
from HEAD and version
from commit xxxxxxxx. And push to resolve conflict.
Problem
The conflict appear due to name
change + version
change. Technically, git detect a conflict, I can understand why, but it's boring me ^^ . So, I moved away the version line from package.json
that's fixing the problem for this file but the package-lock.json
is a solid I can't manage like that.
So!
I think the problem can be reproduce with a branching system since it's just a merging business but this case happen clearly in a fork context with this kind of change. I understand my problem come from the conflict detection I could solve but there is one file I can't manage.
To be clear a last time about what I'm waiting for here :
A way to avoid conflict during merge from base
to fork
on specific declared lines. In this case the lines 2~3 of package-lock.json
.
Any ways are welcome :)
EDIT:
Following @inigo solution, I'm investigate custom merge driver solutions taking praqma sample as model.