How to view conflicts manually resolved in git (github, some app, InteliJ)

For me, manually resolved conflicts are one of the biggest sources of error.

We are currently dealing with conflicts gathering loudly in front of a single monitor, which I consider to be Stone Age practice. Moreover, after saving and closing the visual demarcation tool, we will not be able to return to viewing the conflict later if we want to double-view or fix something.

I'm looking for a way to quickly view all manually resolved conflicts in git.

I would like to see A-branch, B-branch and the resulting code snippet for each conflict.

I can manually give the processed tool a commit number, or I can see conflicts in the list.


Offtopic:

My great idea is to present a merge analysis if there is a conflict. All developers responsible for this piece of code (in both branches) should analyze the conflict, especially when they are working remotely. How about a merge only after confirmation from both sides?

+3


source to share


3 answers


I believe these "flashy matches" could have been avoided by changing the workflow. Let's say a developer is working on a theme branch and they are falling behind master

.

A--B--C--D--E--F
       \
        X--Y--Z

      

Instead of him or the group coming up with a merge, he can simply re-install his changes to his local master

 A--B--C--D--E--F
                 \
                  X'--Y'--Z'

      



Then, when the time is right, it will allow the pure union to be fixed by the "official" master

A--B--C--D--E--F--X'--Y'--Z'

      

ref

+2


source


It's pretty easy with git:

git log --patch -c -1 YOURMERGE

      



This will output something like this:

index ea575f9,b943345..239a586
--- a/file-with-conflicts.txt
+++ b/file-with-conflicts.txt
@@@ -1,1 -1,1 +1,1 @@@
- Version A
 -Version B
++Merge Resolution

      

+2


source


On the page git help log

:

git log --patch -c -1 <commit-id>

-c With this option, the diff output to commit the merge shows the differences from each parent to the result of the merge at the same time instead of showing pairwise the difference between the parent and the result one at a time. Also, it only lists files that have been modified from all parents.

-p, -u, --patch Create a patch (see the section on creating patches).

0


source







All Articles