git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Improving merge of tricky conflicts

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 24, 2020, 20:30 UTC
Message-ID
<xmqq7duslkp0.fsf@gitster.c.googlers.com>
In-Reply-To
<874kpxwghu.fsf@osv.gnss.ru>
Sergey Organov <sorganov@gmail.com> writes:
Show 15 quoted lines
>> If your merge used the merge (as opposed to diff3) style, and seeing
>> that the resulting conflict is not easy to review and you wish you
>> used diff3 style instead, it is way too late for any option to "git
>> merge" to help you.
>
>   $ git merge --abort
>   $ git merge --conflict=diff3 side-branch
>
> or, say, entirely imaginary:
>
>   $ git merge --redo --conflict=diff3 side-branch -- my-file
>
> if merge had --redo option and path limiting support, that could be
> handy for other reasons as well, as I have already pointed elsewhere and
> you disagreed, but still.

You are ignoring the case where you may have successfully resolved conflicts in some paths before you noticed conflicts in some particular files are hard to see in one style and wish if you used the other style, I think.

Surely, you can reset everything away and redo it from scratch, which is what all of the above is, but then you would need a way to stash away the successful half resolution so far before discarding them. Compared to that, "ouch, I screwed up and want a freshly conflicted state back for these paths" would allow you revert only the botched paths without discarding the work you have already done.

> Actually, "git checkout" is not the place where I'd expect to find this
> feature in the first place, so to me it's rather already 99%
> illogical.

One half of the "checkout" (which now exists as a synonym "restore") is to update the working tree files out of various sources, and "conflicted stages in the index" is one of them, so it entirely is natural and logical home for the feature.

The documentation needs updating to help you and others feel it natural, I would think. This seems to be mostly the matter of better education.

Previous: Sergey OrganovNext: Sergey Organov
Message 22 of 25 in “Improving merge of tricky conflicts”
  1. B. SteblerJul 21, 2020
  2. Johannes SixtJul 22, 2020
  3. Jeff KingJul 22, 2020
  4. Junio C HamanoJul 22, 2020
  5. Jeff KingJul 23, 2020
  6. Junio C HamanoJul 24, 2020
  7. Jeff KingJul 24, 2020
  8. Junio C HamanoJul 24, 2020
  9. Martin von ZweigbergkJan 16, 2021
  10. Jeff KingJan 21, 2021
  11. Martin von ZweigbergkJan 21, 2021
  12. Jeff KingJan 21, 2021
  13. Sergey OrganovJul 22, 2020
  14. Junio C HamanoJul 22, 2020
  15. Sergey OrganovJul 22, 2020
  16. Jeff KingJul 23, 2020
  17. Sergey OrganovJul 23, 2020
  18. Junio C HamanoJul 23, 2020
  19. Jacob KellerJul 24, 2020
  20. Junio C HamanoJul 24, 2020
  21. Sergey OrganovJul 24, 2020
  22. Junio C HamanoJul 24, 2020
  23. Sergey OrganovJul 24, 2020
  24. Junio C HamanoJul 24, 2020
  25. Bono SteblerJul 22, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.