Once I execute the git merge A B
command, I can get the list of conflicting files using linux command like
git diff --name-only --diff-filter=U
But, is there a way to get conflicting code snippets along with file names? I want to create a report with just the conflicting code snippets.
For example, I need a report like this
src/com/xyz/ABC.java
<<<<<<< Branch_A
this.codeFromA();
=======
this.codeFromB();
>>>>>>> Branch_B
..and the same section repeats for all conflicting files.
Note that there are other lines in the files. But, only the conflicting code piece is returned.