* Metadata for merge conflicts during rebase (to aid rustc) and potential for better user experience?
@ 2025-12-22 14:31 Esteban Küber
2025-12-22 21:56 ` D. Ben Knoble
0 siblings, 1 reply; 5+ messages in thread
From: Esteban Küber @ 2025-12-22 14:31 UTC (permalink / raw)
To: git
Hi! I'm one of the rustc developers, with a particular focus on developer
experience. This often translates into working a lot on diagnostics to make
compiler errors less verbose when irrelevant, more verbose when context is
needed and generally make the compiler talk to humans as humans, and not
compiler engineers.
I am looking for advice in interacting with git internals correctly, and to
open a conversation on what git itself could do to improve the situation.
One of the things rustc does as part of its parser is identify conflict
markers to provide appropriate output. The current output for the most
verbose case looks like the following:
error: encountered diff marker
--> $DIR/enum.rs:2:1
|
LL | <<<<<<< HEAD
| ^^^^^^^ between this marker and `=======` is the code that we're
merging into
LL | Foo(u8),
LL | =======
| ------- between this marker and `>>>>>>>` is the incoming code
LL | Bar(i8),
LL | >>>>>>> branch
| ^^^^^^^ this marker concludes the conflict region
|
= note: conflict markers indicate that a merge was started but
could not be completed due to merge conflicts
to resolve a conflict, keep only the code you want and then
delete the lines containing conflict markers
= help: if you're having merge conflicts after pulling new code:
the top section is the remote code and the bottom section
is the code you already had
if you're in the middle of a rebase:
the top section is the code being rebased onto and the
bottom section is the code coming from the current commit being
rebased
= note: for an explanation on these markers from the `git` documentation:
visit
<https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
In an attempt to make the output simultaneously less verbose and more
understandable and useful, I set out to make a change that would identify
what the cause of the conflict markers was, if a git operation is indeed the
culprit: https://github.com/rust-lang/rust/pull/150233
What this PR does is effectively:
- `git rev-parse --git-path rebase-merge` to get the rebase metadata
directory
- use the `head-name` as the name for the branch being rebased
- use `git branch --points-at onto` to try and find the branch name that we
rebased onto
- if the above yields no branch names, then *assume* we are in a rebase
caused by `git pull`, use `git branch -r --points-at onto` to get the
remote branch name (likely `origin/main`)
With all of this, the output for the `git rebase` case is:
error: encountered diff marker
--> src/main.rs:2:1
|
2 | <<<<<<< HEAD
| ^^^^^^^ between this marker and `=======` is the code from branch
`master` we're rebasing onto
3 | println!("Hello, main!");
4 | =======
| ------- between this marker and `>>>>>>>` is the code you had in
branch `branch-2` that you are rebasing
5 | println!("Hello, branch!");
6 | >>>>>>> e644375 (branch)
| ^^^^^^^ this marker concludes the conflict region
|
= note: conflict markers indicate that a merge was started but could
not be completed due to merge conflicts
to resolve a conflict, keep only the code you want and then
delete the lines containing conflict markers
= note: for an explanation on these markers from the `git` documentation:
visit
<https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
and for the `git pull` case:
error: encountered diff marker
--> src/main.rs:2:1
|
2 | <<<<<<< HEAD
| ^^^^^^^ between this marker and `=======` is the code from the
remote branch `origin/main` we're rebasing onto
3 | println!("Hello, 1!");
4 | =======
| ------- between this marker and `>>>>>>>` is the code you had in
branch `main` that you are rebasing
5 | println!("Hello, 2!");
6 | >>>>>>> ebbeec7 (second)
| ^^^^^^^ this marker concludes the conflict region
|
= note: conflict markers indicate that a merge was started but could
not be completed due to merge conflicts
to resolve a conflict, keep only the code you want and then
delete the lines containing conflict markers
= note: for an explanation on these markers from the `git` documentation:
visit
<https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
There are of course other cases, like a colleague who got this diagnostic
after a `git stash pop` yesterday, or caused by `git merge`, which the
mentioned PR does not address.
The reason to handle this in the parser is to avoid knock down errors, but
the reason for going out of our way to check the git rebase state is because
it is a *common* source of confusion for even experienced people, as
anecdotally evidenced by the number of threads in different forums asking
for clarification. On the rustc side, there's only so much we can do to
help. When working on the change, I noticed that the git internal state held
some useful and necessary information for git itself to display (like the
branch name for the branch being rebased), but lacked others that would be
incredibly useful for the UI (and me in this case, like the name of the
branch being rebased onto, which would also clarify the user-driven cause of
the rebase). By having to rely instead on `git branch --points-at`, I have
to deal with both the case of multiple branches pointing at the same commit
*and* pay the potentially large cost of scanning all branch tips in
repositories with a large number of local and remote branches.
The questions I have are:
- can I *avoid* `--points-at` in any way to identify what branch we're
rebasing onto?
- is there already a better way to identify if the rebase was triggered by
`git rebase` or `git pull` (configured to rebase)?
- if neither of the above has a "yes" answer, would git consider *adding*
that information, both for third-parties as well as to extend its own UI?
As a somewhat separate concern, would people have a desire to try and
eliminate or minimize the confusion caused by this by modifying the
generated patch output to contain *some* of the information that the
proposed rustc diagnostic includes? I have concerns that having this in the
text output would be verbose, and could get annoying, particularly for those
for whom the git workflow is already second nature, but I am convinced that
there's a better default that can be found that strikes a balance between
verbosity and understandability.
Kind regards,
Esteban Küber
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Metadata for merge conflicts during rebase (to aid rustc) and potential for better user experience?
2025-12-22 14:31 Metadata for merge conflicts during rebase (to aid rustc) and potential for better user experience? Esteban Küber
@ 2025-12-22 21:56 ` D. Ben Knoble
2025-12-24 15:03 ` Esteban Küber
0 siblings, 1 reply; 5+ messages in thread
From: D. Ben Knoble @ 2025-12-22 21:56 UTC (permalink / raw)
To: Esteban Küber; +Cc: git
On Mon, Dec 22, 2025 at 9:31 AM Esteban Küber <esteban@kuber•com.ar> wrote:
>
> The questions I have are:
> - can I *avoid* `--points-at` in any way to identify what branch we're
> rebasing onto?
According to "git help rebase", ORIG_HEAD is not reliable but @{1} should be.
> - is there already a better way to identify if the rebase was triggered by
> `git rebase` or `git pull` (configured to rebase)?
I haven't studied the internals on this yet, but I think the common
pattern is to look at REBASE_HEAD vs. MERGE_HEAD.
> - if neither of the above has a "yes" answer, would git consider *adding*
> that information, both for third-parties as well as to extend its own UI?
I think "git status" already shows some of this (maybe not the
branches in question, but certainly the "it looks like you're in the
middle of a rebase/merge/cherry-pick/etc.").
--
D. Ben Knoble
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Metadata for merge conflicts during rebase (to aid rustc) and potential for better user experience?
2025-12-22 21:56 ` D. Ben Knoble
@ 2025-12-24 15:03 ` Esteban Küber
2025-12-27 18:22 ` Ben Knoble
2026-01-06 14:29 ` Phillip Wood
0 siblings, 2 replies; 5+ messages in thread
From: Esteban Küber @ 2025-12-24 15:03 UTC (permalink / raw)
To: D. Ben Knoble; +Cc: git
On Mon, Dec 22, 2025 at 1:56 PM D. Ben Knoble <ben.knoble@gmail•com> wrote:
> On Mon, Dec 22, 2025 at 9:31 AM Esteban Küber <esteban@kuber•com.ar> wrote:
> >
> > The questions I have are:
> > - can I *avoid* `--points-at` in any way to identify what branch we're
> > rebasing onto?
>
> According to "git help rebase", ORIG_HEAD is not reliable but @{1} should be.
After talking with other members of the compiler team, people have
concerns about invoking git from the compiler, as it can be a vector
for unwanted behavior. I would agree with that assessment, so I am
trying to settle on a mechanism where I can parse git state myself
(on a best-effort basis; this is only for diagnostics, so fully
featured support for all environments is not necessary).
> > - is there already a better way to identify if the rebase was triggered by
> > `git rebase` or `git pull` (configured to rebase)?
>
> I haven't studied the internals on this yet, but I think the common
> pattern is to look at REBASE_HEAD vs. MERGE_HEAD.
Thank you for the additional information! That prompted me to look
into the rest of the files once more, which gave me some hacky ideas
on how to get the data I want, and this indeed seems to be
sufficient to differentiate these two.
> > - if neither of the above has a "yes" answer, would git consider *adding*
> > that information, both for third-parties as well as to extend its own UI?
>
> I think "git status" already shows some of this (maybe not the
> branches in question, but certainly the "it looks like you're in the
> middle of a rebase/merge/cherry-pick/etc.").
I looked around again and arrived to the following conclusions:
- presence of .git/rebase-merge (and its files) is enough to
differentiate between a rebase and a merge
- .git/rebase-merge/head-name is enough to identify one of the sections
- identifying *at least* one of the sections is enough to make the
output clear enough (even if ideally you'd identify both)
- the sha in FETCH_HEAD matching .git/rebase-merge/onto is enough
to identify that we're dealing with a `git rebase --rebase`
- there's information that is only present in MERGE_MSG in
free-form text, that isn't present anywhere else
- I can extract the "missing" information for either the
identifying information of where we are merging, be it because of
a `git pull --no-rebase` or `git merge`; the only issue I see is
in having to rely that the output will not change from either of
"Merge branch 'main' into branch-name" and
"Merge branch 'main' of example.url:user/repo" (how much trouble
am I inviting if I were to try and rely on this text not changing
so that I can get 'main' and the remote url from here?)
With this, I'm successfully able to identify at least one of the
sections in the patches in all cases, which is "good enough" for my
use-case, and with some hacks I can identify both for all but the
`git rebase` case, without having to invoke git.
Beyond hearing from any warnings about me relying on the textual
format of MERGE_MSG or mistakes on the assumptions laid above, I
would like to suggest two changes to git that I think would be
beneficial to devs and users.
First, the information present in MERGE_MSG should be available in a
more structured format, to allow for tools to deal with git state in
a less coupled way. (This might not be worth it, and the textual
representation is already "stable enough" to rely on.)
Secondly, and perhaps more importantly, when generating the diff
markers that end up in the user files, their description includes
only the full sha or HEAD, or the short-sha and the commit message.
I would propose that the branch be identified as well in the
generated code. This could look something like:
`git rebase`:
<<<<<<< HEAD [branch 'main']
=======
>>>>>>> e644375 (commit message) [branch 'name']
`git merge`:
<<<<<<< HEAD [branch 'name']
=======
------- between this marker and `>>>>>>>` is the code from branch 'master'
println!("Hello, main!");
>>>>>>> [branch 'main']
`git pull --rebase`:
<<<<<<< HEAD [local branch 'main']
=======
>>>>>>> 8191e7e4f9f82be45bdd4e71c37d2adcf4f88aa2 [branch 'main' of example.tld:user/repo]
`git pull --no-rebase`:
<<<<<<< HEAD [branch 'main' of example.tld:user/repo]
=======
>>>>>>> ebbeec7 (commit message) [local branch 'main']
The format doesn't have to match the above exactly, but having the
commit *and branch* information will make it much easier for people
to identify things at a glance, at the cost of some additional
verbosity in the generated code.
The source of the issue is that where "our" and "their" code is in
the patch depends on a somewhat "arbitrary" distinction (as far as
a non-implementer is concerned) and it *swaps places* depending on
whether we are rebasing or merging. Adding some context to the
resulting patches would go a long way of mitigating the confusion
this causes.
Happy holidays,
Esteban Küber
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Metadata for merge conflicts during rebase (to aid rustc) and potential for better user experience?
2025-12-24 15:03 ` Esteban Küber
@ 2025-12-27 18:22 ` Ben Knoble
2026-01-06 14:29 ` Phillip Wood
1 sibling, 0 replies; 5+ messages in thread
From: Ben Knoble @ 2025-12-27 18:22 UTC (permalink / raw)
To: Esteban Küber; +Cc: git
> Le 24 déc. 2025 à 10:03, Esteban Küber <esteban@kuber•com.ar> a écrit :
>
> On Mon, Dec 22, 2025 at 1:56 PM D. Ben Knoble <ben.knoble@gmail•com> wrote:
>>> On Mon, Dec 22, 2025 at 9:31 AM Esteban Küber <esteban@kuber•com.ar> wrote:
>>> The questions I have are:
>>> - can I *avoid* `--points-at` in any way to identify what branch we're
>>> rebasing onto?
>> According to "git help rebase", ORIG_HEAD is not reliable but @{1} should be.
>
> After talking with other members of the compiler team, people have
> concerns about invoking git from the compiler, as it can be a vector
> for unwanted behavior. I would agree with that assessment, so I am
> trying to settle on a mechanism where I can parse git state myself
> (on a best-effort basis; this is only for diagnostics, so fully
> featured support for all environments is not necessary).
>
>>> - is there already a better way to identify if the rebase was triggered by
>>> `git rebase` or `git pull` (configured to rebase)?
>> I haven't studied the internals on this yet, but I think the common
>> pattern is to look at REBASE_HEAD vs. MERGE_HEAD.
>
> Thank you for the additional information! That prompted me to look
> into the rest of the files once more, which gave me some hacky ideas
> on how to get the data I want, and this indeed seems to be
> sufficient to differentiate these two.
I think you will have issues with the reftables backend, then, which stores references differently (and is _probably_ simpler to access via git, though this might motivate contributing support to libgit2; this was also mentioned recently in Discord).
>
>>> - if neither of the above has a "yes" answer, would git consider *adding*
>>> that information, both for third-parties as well as to extend its own UI?
>> I think "git status" already shows some of this (maybe not the
>> branches in question, but certainly the "it looks like you're in the
>> middle of a rebase/merge/cherry-pick/etc.").
>
> I looked around again and arrived to the following conclusions:
>
> - presence of .git/rebase-merge (and its files) is enough to
> differentiate between a rebase and a merge
> - .git/rebase-merge/head-name is enough to identify one of the sections
> - identifying *at least* one of the sections is enough to make the
> output clear enough (even if ideally you'd identify both)
> - the sha in FETCH_HEAD matching .git/rebase-merge/onto is enough
> to identify that we're dealing with a `git rebase --rebase`
> - there's information that is only present in MERGE_MSG in
> free-form text, that isn't present anywhere else
> - I can extract the "missing" information for either the
> identifying information of where we are merging, be it because of
> a `git pull --no-rebase` or `git merge`; the only issue I see is
> in having to rely that the output will not change from either of
> "Merge branch 'main' into branch-name" and
> "Merge branch 'main' of example.url:user/repo" (how much trouble
> am I inviting if I were to try and rely on this text not changing
> so that I can get 'main' and the remote url from here?)
I think you can also get just remote names here, and I’m not sure how to define remote URL when I think there’s support for multiple URLs for a single remote, so it would be a lot of best-effort work IMO. Not that it isn’t worth it, but you’d want to decide what is worth putting the effort into.
>
> With this, I'm successfully able to identify at least one of the
> sections in the patches in all cases, which is "good enough" for my
> use-case, and with some hacks I can identify both for all but the
> `git rebase` case, without having to invoke git.
>
> Beyond hearing from any warnings about me relying on the textual
> format of MERGE_MSG or mistakes on the assumptions laid above, I
> would like to suggest two changes to git that I think would be
> beneficial to devs and users.
>
> First, the information present in MERGE_MSG should be available in a
> more structured format, to allow for tools to deal with git state in
> a less coupled way. (This might not be worth it, and the textual
> representation is already "stable enough" to rely on.)
I think specifying what information is valuable here would help inform a concrete proposal. My first thought is that it could be added to {human,machine}-readable git status, but that’s less accessible to programs that don’t want to invoke Git.
>
> Secondly, and perhaps more importantly, when generating the diff
> markers that end up in the user files, their description includes
> only the full sha or HEAD, or the short-sha and the commit message.
> I would propose that the branch be identified as well in the
> generated code. This could look something like:
>
> `git rebase`:
> <<<<<<< HEAD [branch 'main']
> =======
>>>>>>>> e644375 (commit message) [branch 'name']
>
> `git merge`:
> <<<<<<< HEAD [branch 'name']
> =======
> ------- between this marker and `>>>>>>>` is the code from branch 'master'
> println!("Hello, main!");
>>>>>>>> [branch 'main']
>
> `git pull --rebase`:
> <<<<<<< HEAD [local branch 'main']
> =======
>>>>>>>> 8191e7e4f9f82be45bdd4e71c37d2adcf4f88aa2 [branch 'main' of example.tld:user/repo]
>
> `git pull --no-rebase`:
> <<<<<<< HEAD [branch 'main' of example.tld:user/repo]
> =======
>>>>>>>> ebbeec7 (commit message) [local branch 'main']
>
> The format doesn't have to match the above exactly, but having the
> commit *and branch* information will make it much easier for people
> to identify things at a glance, at the cost of some additional
> verbosity in the generated code.
I suppose if no branch was used in the original operation, we could omit it.
I would probably say “from branch X,” since in a typical rebase only the very last commit is actually pointed at directly by the branch.
> The source of the issue is that where "our" and "their" code is in
> the patch depends on a somewhat "arbitrary" distinction (as far as
> a non-implementer is concerned) and it *swaps places* depending on
> whether we are rebasing or merging. Adding some context to the
> resulting patches would go a long way of mitigating the confusion
> this causes.
>
> Happy holidays,
> Esteban Küber
I can’t seem to puzzle it out, but it seems like perhaps you’d have a better solution than optionally sprinkling branch names if we addressed (somehow) this other issue about location of code? Idk.
Of course you won’t be able to assume “main” is always the effective “ours” ;) so maybe I’m confused about how those 2 things play together.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Metadata for merge conflicts during rebase (to aid rustc) and potential for better user experience?
2025-12-24 15:03 ` Esteban Küber
2025-12-27 18:22 ` Ben Knoble
@ 2026-01-06 14:29 ` Phillip Wood
1 sibling, 0 replies; 5+ messages in thread
From: Phillip Wood @ 2026-01-06 14:29 UTC (permalink / raw)
To: Esteban Küber, D. Ben Knoble; +Cc: git
Hi Esteban
On 24/12/2025 15:03, Esteban Küber wrote:
> On Mon, Dec 22, 2025 at 1:56 PM D. Ben Knoble <ben.knoble@gmail•com> wrote:
>> On Mon, Dec 22, 2025 at 9:31 AM Esteban Küber <esteban@kuber•com.ar> wrote:
>>>
>>> The questions I have are:
>>> - can I *avoid* `--points-at` in any way to identify what branch we're
>>> rebasing onto?
>>
>> According to "git help rebase", ORIG_HEAD is not reliable but @{1} should be.
>
> After talking with other members of the compiler team, people have
> concerns about invoking git from the compiler, as it can be a vector
> for unwanted behavior.
If we're talking about "git rev-parse --git-path" then that does not run
any hooks or external processes. In a linked worktree or submodule then
".git" is a file rather than a directory. You will need to read the file
(which looks like "gitdir: <path>\n" to find the path to the directory.
> I would agree with that assessment, so I am
> trying to settle on a mechanism where I can parse git state myself
> (on a best-effort basis; this is only for diagnostics, so fully
> featured support for all environments is not necessary).
>
>>> - is there already a better way to identify if the rebase was triggered by
>>> `git rebase` or `git pull` (configured to rebase)?
>>
>> I haven't studied the internals on this yet, but I think the common
>> pattern is to look at REBASE_HEAD vs. MERGE_HEAD.
>
> Thank you for the additional information! That prompted me to look
> into the rest of the files once more, which gave me some hacky ideas
> on how to get the data I want, and this indeed seems to be
> sufficient to differentiate these two.
>
>>> - if neither of the above has a "yes" answer, would git consider *adding*
>>> that information, both for third-parties as well as to extend its own UI?
>>
>> I think "git status" already shows some of this (maybe not the
>> branches in question, but certainly the "it looks like you're in the
>> middle of a rebase/merge/cherry-pick/etc.").
>
> I looked around again and arrived to the following conclusions:
>
> - presence of .git/rebase-merge (and its files) is enough to
> differentiate between a rebase and a merge
Being pedantic the presence of ".git/rebase-merge" tells us that a
rebase is in progress, it does not guarantee that the conflicts were
created by the rebase though as it is possible for the user to run "git
merge", "git cherry-pick" or "git revert" during a rebase. When a commit
is being split it is possible that the conflicts come from "git stash
pop" if the user stashes some changes, edits a file, commits and then
pops the stashed changes.
> - .git/rebase-merge/head-name is enough to identify one of the sections
Yes, that will give you the name of the branch being rebased.
> - identifying *at least* one of the sections is enough to make the
> output clear enough (even if ideally you'd identify both)
> - the sha in FETCH_HEAD matching .git/rebase-merge/onto is enough
> to identify that we're dealing with a `git rebase --rebase`
Note that FETCH_HEAD stays around until it is overwritten by the next
fetch so that if I run
git pull --rebase
followed by one of
git rebase --autosquash [--keep-base]
git rebase -i [--keep-base]
without running "git fetch" then ".git/rebase-merge/onto" will match
FETCH_HEAD but I'm not running "git pull" and I'm not rebasing onto a
new base so any conflicts come from re-arranging the existing commits,
not from changes in the upstream branch.
I think the most sensible way of solving this is for "git rebase" to
start writing a description of the "onto" commit to
".git/rebase-merge/onto-desc". That would allow the output of "git
status" to include the branch or tag that we're rebasing onto as well.
I've got a rough patch that creates that file in common cases. If the
base of the branch is not being changed the file contains "same base"
[1], if "onto" matches the upstream branch it contains "upstream <ref>"
where <ref> is the full ref of the upstream branch. If the argument
given to "--onto" is a ref then the file contains the full name of the
ref [2]. Finally when rebasing onto a new root commit it contains "new
root".
[1] Detecting that in the general case involves a revision walk which
I'd like to avoid so it only works in common cases like
git rebase -i HEAD~<n>
git rebase --keep-base --autostash
git rebase -i --onto ...@{u}
[2] If "--onto" is omitted then it defaults to "<upstream>" so if the
user runs "git rebase some-branch" the file will contain
"refs/heads/some-branch". Unfortunately "git pull --rebase" passes
object id's rather than refnames when it run "git rebase" so the
branch name is only detected when rebasing onto the upstream branch.
I'll try and post a patch next week.
> - there's information that is only present in MERGE_MSG in
> free-form text, that isn't present anywhere else
I assume that's the name of the branch we're merging into HEAD. For
squash merges the equivalent file is SQUASH_MSG.
> - I can extract the "missing" information for either the
> identifying information of where we are merging, be it because of
> a `git pull --no-rebase` or `git merge`; the only issue I see is
> in having to rely that the output will not change from either of
> "Merge branch 'main' into branch-name" and
> "Merge branch 'main' of example.url:user/repo" (how much trouble
> am I inviting if I were to try and rely on this text not changing
> so that I can get 'main' and the remote url from here?)
I'd be surprised if the messages changed but I don't think anyone is
going to pledge that they'll never change. You read the object id out of
MERGE_HEAD (that is always a file even if the repository is using the
reftable backend) and use "git for-each-ref --points-at" to find the
branch name.
> First, the information present in MERGE_MSG should be available in a
> more structured format, to allow for tools to deal with git state in
> a less coupled way. (This might not be worth it, and the textual
> representation is already "stable enough" to rely on.)
That might be useful for "git status" as we could say which branch was
being merged.
> Secondly, and perhaps more importantly, when generating the diff
> markers that end up in the user files, their description includes
> only the full sha or HEAD, or the short-sha and the commit message.
> I would propose that the branch be identified as well in the
> generated code. This could look something like:
>
> `git rebase`:
> <<<<<<< HEAD [branch 'main']
In the general case HEAD isn't really the branch 'main', it is main plus
whatever commits we've already applied. I think I saw someone suggest
[from 'main'] which might be better
> =======
>>>>>>>> e644375 (commit message) [branch 'name']
Unless we're applying the last commit from the branch this isn't branch
'name' but one of the commit from it.
>
> `git merge`:
> <<<<<<< HEAD [branch 'name']
> =======
> ------- between this marker and `>>>>>>>` is the code from branch 'master'
I'm skeptical that we want to inject extra text into the conflicted
region. It makes sense for rustc's diagnostics but it makes it harder to
resolve the conflict if we inject them into the file.
> println!("Hello, main!");
>>>>>>>> [branch 'main']
For merges [branch '<name>'] definitely makes sense for the two merge
heads, I'm not sure what we'd do for the merge base though.
> `git pull --rebase`:
> <<<<<<< HEAD [local branch 'main']
Do we really need a different label when pulling?
> =======
>>>>>>>> 8191e7e4f9f82be45bdd4e71c37d2adcf4f88aa2 [branch 'main' of example.tld:user/repo]
Ideally we'd use the remote tracking branch here when pulling from a
configured remote repository rather than giving the name of the branch
on the remote and it's url.
> `git pull --no-rebase`:
> <<<<<<< HEAD [branch 'main' of example.tld:user/repo]
> =======
>>>>>>>> ebbeec7 (commit message) [local branch 'main']
>
> The format doesn't have to match the above exactly, but having the
> commit *and branch* information will make it much easier for people
> to identify things at a glance, at the cost of some additional
> verbosity in the generated code.
>
> The source of the issue is that where "our" and "their" code is in
> the patch depends on a somewhat "arbitrary" distinction (as far as
> a non-implementer is concerned) and it *swaps places* depending on
> whether we are rebasing or merging. Adding some context to the
> resulting patches would go a long way of mitigating the confusion
> this causes.
I agree having some indication of which branch each side comes would be
useful but I think when rebasing it needs to be clear that the branch
does not necessarily point to that particular commit.
Thanks
Phillip
> Happy holidays,
> Esteban Küber
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-06 14:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22 14:31 Metadata for merge conflicts during rebase (to aid rustc) and potential for better user experience? Esteban Küber
2025-12-22 21:56 ` D. Ben Knoble
2025-12-24 15:03 ` Esteban Küber
2025-12-27 18:22 ` Ben Knoble
2026-01-06 14:29 ` Phillip Wood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox