From: Bono Stebler <bono.stebler@gmail.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: git@vger.kernel.org
Subject: Re: Improving merge of tricky conflicts
Date: Thu, 23 Jul 2020 00:48:33 +0200 [thread overview]
Message-ID: <7c3cf4f4-c8aa-66d6-ae6f-88271e21d5ae@gmail.com> (raw)
In-Reply-To: <4df975f0-e4b1-afa1-cac1-f38e6d31a0d8@kdbg.org>
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
prev parent reply other threads:[~2020-07-22 22:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-21 23:29 Improving merge of tricky conflicts B. Stebler
2020-07-22 5:50 ` Johannes Sixt
2020-07-22 7:45 ` Jeff King
2020-07-22 17:26 ` Junio C Hamano
2020-07-23 18:25 ` Jeff King
2020-07-24 1:19 ` Junio C Hamano
2020-07-24 19:48 ` Jeff King
2020-07-24 20:18 ` Junio C Hamano
2021-01-16 2:50 ` Martin von Zweigbergk
2021-01-21 14:28 ` Jeff King
2021-01-21 20:30 ` Martin von Zweigbergk
2021-01-21 21:08 ` Jeff King
2020-07-22 20:17 ` Sergey Organov
2020-07-22 21:14 ` Junio C Hamano
2020-07-22 21:20 ` Sergey Organov
2020-07-23 18:26 ` Jeff King
2020-07-23 19:11 ` Sergey Organov
2020-07-23 21:39 ` Junio C Hamano
2020-07-24 5:15 ` Jacob Keller
2020-07-24 6:01 ` Junio C Hamano
2020-07-24 6:53 ` Sergey Organov
2020-07-24 20:30 ` Junio C Hamano
2020-07-24 22:11 ` Sergey Organov
2020-07-24 23:04 ` Junio C Hamano
2020-07-22 22:48 ` Bono Stebler [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c3cf4f4-c8aa-66d6-ae6f-88271e21d5ae@gmail.com \
--to=bono.stebler@gmail.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).