简体   繁体   中英

NodeGit - resolve merge conflict in favor of “theirs”

In git we can use following command to achieve it:

git merge branch_name --strategy-option theirs

But I couldn't figure out a way in nodegit: http://www.nodegit.org/api/repository/#mergeBranches

 repo.mergeBranches("master.min", "master", null, merge.PREFERENCE.FASTFORWARD_ONLY);

A file favor enum is present

http://www.nodegit.org/api/merge/#FILE_FAVOR

But repo.mergeBranches() expects PREFERENCE enum. How do I pass FILE_FAVOR enum for merge.

Edit: Adding a tracking issue:

https://github.com/nodegit/nodegit/issues/858

For now (January 2015), you don't.

The way Repository.prototype.mergeBranches ( lib/repository.js#L730-L745 ) is implemented, it doesn't take into account any FILE_FAVOR option (used by their vendored libgit2 ).

That could be the topic of a PR (Pull Request) similar to PR 633 (which introduced the options --no-ff and --ff-only )

你现在不能使用repo.mergeBranches函数(虽然我会遇到问题所以我们可以解决这个问题),但是如果你看看repo.mergeBranches的源代码,你可以看到我们如何直接调用nodegit.merge (mergebranches是一个js方便包装器),它确实采用合并,允许您传递文件首选项和其他枚举(截至2016年1月)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM