在git中我们可以使用如下命令来实现:
git merge branch_name --strategy-option theirs
但我无法在 nodegit 中找到方法:http://www.nodegit.org/api/repository/#mergeBranches
repo.mergeBranches("master.min", "master", null, merge.PREFERENCE.FASTFORWARD_ONLY);
存在一个文件偏好枚举
http://www.nodegit.org/api/merge/#FILE_FAVOR
但是 repo.mergeBranches()
需要 PREFERENCE
枚举。如何为 merge 传递 FILE_FAVOR
枚举。
编辑:添加跟踪问题:
最佳答案
目前(2015 年 1 月),您不需要。
方式Repository.prototype.mergeBranches
(lib/repository.js#L730-L745
)已实现,它不考虑任何 FILE_FAVOR 选项(由 their vendored libgit2 使用)。
这可能是类似于 PR 633 的 PR( pull 请求)的主题(其中引入了选项 --no-ff
和 --ff-only
)
关于javascript - NodeGit - 解决有利于 "theirs"的 merge 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34671270/