git合并重复冲突

bor*_*ast 9 git merge

我有一个分支master和分支feature,将其从签出master.

master从其他开发人员那里得到了提交,我经常合并master回来feature,以便跟上其他分支机构的新发展.

但是,每次执行此操作时git merge master,我都会在相同的文件中遇到相同的冲突,尽管我之前解决了冲突并提交了更改.

关于可能是什么原因以及如何预防它的任何想法?

谢谢!

oua*_*uah 5

首先考虑不要将集成分支合并到功能分支中。

其次看看git rerere命令并使用它:

$ git config --global rerere.enabled true
Run Code Online (Sandbox Code Playgroud)

名称

  git-rerere - Reuse recorded resolution of conflicted merges
Run Code Online (Sandbox Code Playgroud)

描述

  In a workflow employing relatively long lived topic branches,
  the developer sometimes needs to resolve the same conflicts
  over and over again until the topic branches are done (either
  merged to the "release" branch, or sent out and accepted upstream)
Run Code Online (Sandbox Code Playgroud)

  • 顺便说一句,您建议不要将集成分支合并到功能分支中。原则上这听起来不错(直到最近我才这样做),但是你如何处理长期分支?你是否只在最后,当你完成它们时才合并它们?这有时意味着_很多_变化,这是危险的,而这正是我们通过定期将“master”合并到“feature”中试图避免的。 (2认同)