1

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!

  • Turns out, there's another option to use the [git merge "subtree" strategy](http://stackoverflow.com/a/366940/1445241) to do this, but I have not tried it. Leave a note if you have. – Matt Senate Sep 18 '12 at 00:25

1 Answers1

0

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.

Waiting for Dev...
  • 12,629
  • 5
  • 47
  • 57
  • aha, checkout works, followed by the appropriate `git add whatever` and a `git commit`. I suppose if I wanted to automate it, I could take advantage of _git submodules_ or treat the incoming branch like a proper upstream. – Matt Senate Sep 10 '12 at 19:46