Re: Improving merge of tricky conflicts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you for your reply, and everyone else in the thread. I've played with diff3 and while it is slightly better in some cases, I feel there is a much better solution. To illustrate:

Commit 1: https://i.snipboard.io/Ssm7M9.jpg
Commit 2: https://i.snipboard.io/l2pqdT.jpg
Diff3: https://i.snipboard.io/teb1RS.jpg

What I would actually want: https://i.snipboard.io/8dOHgV.jpg

After looking at it and some research, I've managed to mostly automate it. You need to manually set the filename, which isn't as convenient as having the details directly in the file, but it beats rummaging in commits manually by a lot:

# Patch failed at 0001 smol commit

FILENAME="conflicting.txt"

THEIRS=$(head -1 .git/rebase-apply/0001 | awk '{ print $2 }')

OURS=$(git rev-parse HEAD)

THEIRS_DIFF=$(git -c color.ui=always show -U0 $THEIRS $FILENAME | tail -n +12)

OURS_DIFF=$(git -c color.ui=always show -U0 $OURS $FILENAME | tail -n +12)

printf "<<<<<<<<\n$OURS_DIFF\n========\n$THEIRS_DIFF\n>>>>>>>>\n"

Voilà, feel free to use that or suggest improvements, I am by no means a bash or git wizard!

Cheers,
B

On 22/07/2020 07:50, Johannes Sixt wrote:
Am 22.07.20 um 01:29 schrieb B. Stebler:
I have been looking for a tool to display merge conflicts, that instead
of showing the two versions of the conflicting section, would show the
diff for that section in both conflicting commits.
Perhaps you want to configure `merge.conflictStyle=diff3`? It does not
exactly show a diff, but it writes the base version of the conflicted
part in addition to "ours" and "theirs".

-- Hannes



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux