Question

I've got a git repository with some libraries, tracked normally (not as submodules or anything). I'm merging in a separate branch (not an upstream) that contains an update to one of the libraries. It may be the case that I can implement a more intelligent merge strategy, but let's say that I use the naive merge (not too unreasonable, right?).

Is there any way, once I've already executed

 git merge incoming-branch

to now automatically and recursively resolve sub-dir/some/lib/* to favor "their" changes from the incoming branch?

If there's an obvious or effective merge strategy for this, please feel free to share that as well, but I am also particularly curious about this after-naive-merge question. Thanks!

Was it helpful?

Solution

You can do:

git checkout --theirs whatever

The other way would be:

git checkout --ours whatever

To make it automatic, maybe you could use some hook, but there is no post-pull hook. Maybe using a pre-commit would work. The post-merge would not work, because it is fired when there is no merge conflict.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top