Copy allowed git merge to another merge

In my git workflow, I need to merge the branch featureinto master. However, when I resolve merge conflicts, someone pressed a new commit on featureand master.

Then I need to generate a new merge based on new featureand new master. However, 90% of merger conflicts remain the same. So my question is. Can I save my progress from first mergeand apply it in the conflict phase new merge?

 +--------+        +--------+             +------------+
 |        |        |        |             |            |
 |  init  +------> | master +-----------> | new master |
 |        |        |        |             |            |
 +--------+        +--------+             +------------+
       |                 |                             |
       |           +---------+            +-------------+
       |           |         |            |             |
       +---------> | feature +----------> | new feature |
                   |         |            |             |
                   +---------+            +-------------+
                    |    |                            ||
                    |    |                            ||
                    |    |      +----------------+    ||        +-----------+
                    |    +----> |                |    +--------->           |
                    |           |   first merge  |    |         | new merge |
                    +----------->                |    +--------->           |
                                +----------------+              +-----------+
+6
source share
1 answer

Git has a feature called rerere. It can be used in this situation. Include rerere in the configuration file and it just works. I think this is the right way to solve this problem.

https://git-scm.com/blog/2010/03/08/rerere.html

https://git-scm.com/docs/git-rerere

, script https://github.com/git/git/blob/master/contrib/rerere-train.sh.

, . new feature first merge, new master.

+1

All Articles