git - 用于解决并行加法的 Diff/merge 算法
问题描述
我们正在创建一种新的方法。它的一部分是一种实现模式,旨在使并行化编码成为可能。
只有少数几个领域存在冲突,它们应该很容易解决。编码人员只需添加代码块(常量和方法,在一种情况下,在方法中添加外观一致的表达式)。
然而,我们看到我们认为可以自动解决的冲突,但 git 不知何故无法解决它们。是否有选项或工具可以做到这一点?如果没有,可以使用什么算法以及如何将其集成到 git 中?
我尝试了以下方法:
git merge -X patience otherbranch
git merge -X patience -X diff-algorithm=patience otherbranch
git merge -X patience -X diff-algorithm=histogram otherbranch
git merge -s resolve otherbranch
git merge -s renormalize otherbranch
git merge -X patience -X diff-algorithm=histogram -X renormalize otherbranch
git merge -s subtree otherbranch
以下是此类冲突的一些示例:
- 添加的字段
<<<<<<< feature/issue_105
public static final String TASK_DESCRIPTION_START = "Task Description: \n";
public static final String TASK_DESCRIPTION_END =
"\n End of Task Description \n";
public static final String DIFF = "Diff: \n";
=======
public static final String BALANCE_LESS_THAN_USER_BUDGET =
"The user balance is less than project budget";
>>>>>>> develop
- 添加了方法,差异对边界感到困惑
<<<<<<< feature/issue_151
public static TaskEntity getTaskOne() {
final TaskEntity taskEntity = get();
taskEntity.setId(TaskTestData.ID_ONE);
return taskEntity;
=======
public static TaskEntity getGrabbedOverThreeDays() {
final TaskEntity taskEntity = get();
taskEntity.setStatus(TaskStatusEnum.IN_PROGRESS);
taskEntity.setGrabDate(TaskTestData.DATE_OLDER_THAN_THREE_DAYS);
return taskEntity;
>>>>>>> develop
}
- 只添加了一侧
<<<<<<< feature/issue_135
=======
public static MarketUserEntity getRoleProjectManager() {
final MarketUserEntity marketUserEntity = get();
marketUserEntity.setUser(UserEntityTestData.getRoleProjectManager());
return marketUserEntity;
}
>>>>>>> develop
解决方案
推荐阅读
- vue.js - Vue如何将数组复制到本地进行编辑?为什么它适用于字符串而不适用于数组?
- java - 我如何拥有自己的公钥来加密数据?
- vba - 网页抓取:xmlHTTP GET 请求不起作用
- python - 如何通过 python 访问画布颜色
- javascript - 如何将纵向图像放入带有横向图像的引导轮播?
- sql-server - JSON 解析 SQL Server
- javascript - 如何修复这个 MIME 类型错误,这是我认为的主要问题
- python - 叶热图 HTML 未在浏览器中显示
- python - 错误:n = int(input())ValueError:int()的无效文字,底数为10:'N / A'
- wordpress - 更改缓存过期时间