Automatically and recursively favor ours/theirs for sub-dir in git merge conflict resolution

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!

Answers


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.


Need Your Help

QSslSocket::startServerEncryption fails with “PEM_READ_BIO_PRIVATEKEY:bad password read”

c++ qt ssl openssl qsslsocket

I've created an SSL server using the sample code from the Qt documentation. I then connect to it using QSslSocket::connectToHostEncrypted.

Empty Mime Type

javascript mime-types w3c fileapi

I'm trying to load .zip file (with type validation) - and its mime type is empty string. it's strange because it is reproducible only in chrome and only on few computers (!!!)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.