我正试图从远程分支拉到我的本地。如果存在合并冲突,我已将合并策略设置为OURS,即它应该仅采用我的本地更改。
但合并结果显示,"合并策略OURS已导致快速合并"它正在使远程变更与战略集(OURS)相矛盾。如何在JGit中解决这个问题?
PullCommand pullCommand = git.pull().setRemoteBranchName(file.getProperty("remoteBranchName"));
System.out.println("repository state"+pullCommand.getRepository().getRepositoryState());
//Pull the latest changes if the repository is in safe state
if(RepositoryState.SAFE == pullCommand.getRepository().getRepositoryState()){
//Merge strategy to be used if there are merge conflicts
//OURS - to get the local changes, THEIRS- to get remote changes
if("THEIRS".equalsIgnoreCase(file.getProperty("mergeStrategy"))){
pullCommand.setStrategy(MergeStrategy.THEIRS);
}
else if("OURS".equalsIgnoreCase(file.getProperty("mergeStrategy"))){
pullCommand.setStrategy(MergeStrategy.OURS);
}
//Executes the Pull command
result = pullCommand.call();
MergeResult result2 = result.getMergeResult();