How to merge code and resolve conflicts easier with git?

There is a great option --patch , which can be used with git add .

Using this option, I can easily review all my changes and decide which pieces should be added to the staging area. This interactive process can be performed through all modified files.

I am looking for something like this to resolve conflicts. After rebase or merge you often get a list of both modified files.

Is there any team that:

1) help me iterate over all these both modified files? This is very annoying when I have to copy each path to a file to manually open it.

2) will automatically resolve all conflicts using HEAD / main version?

+6
source share
3 answers

After several years of searching, I finally found a solution to my problem! This is not perfect, and, of course, this is not a solution to all my problems, but, of course, it speeds up my work!

It is called git imerge (incremental merge).

At first it is a little overwhelming and seems complicated, but the idea behind a gradual merger is very simple.

Of course, you should take a look at the git -imerge presentation from the GitMerge 2013 conference (20 minutes) .

If you prefer to read the text, git -imerge: Practical introduction

+1
source

You should take a look at git mergetool , which should help resolve conflicts through the command line.

+2
source

Try p4merge . You can easily configure it to work with mergetool and interactively choose which version you prefer.

+1
source

Source: https://habr.com/ru/post/892305/


All Articles