Re: 2.43+ git checkout --theirs on stash error - no alternative?
- From
- Devste Devste <devstemail@gmail.com>
- Date
- Nov 6, 2024, 10:16 UTC
- Message-ID
- <CANM0SV3iF5str0r=BKUOV=wu+Ljn-hR2xcs3zqxfXWrhUigOJQ@mail.gmail.com>
- In-Reply-To
- <xmqqmsifwbes.fsf@gitster.g>
Afaik it means any conflicts should be resolved using --theirs strategy (like in git merge-file --theirs) and if I remember correctly, this is also how it behaved when testing it.
On Mon, 4 Nov 2024 at 11:17, Junio C Hamano <gitster@pobox.com> wrote:
Show 30 quoted lines
>
> Devste Devste <devstemail@gmail.com> writes:
>
> > On Mon, 28 Oct 2024 at 00:38, Taylor Blau <me@ttaylorr.com> wrote:
> >>
> >> On Sun, Oct 27, 2024 at 11:31:05PM +0100, Devste Devste wrote:
> >> > Turns out the previous behavior can be achieved with
> >> > git restore --source='stash@{0}' -- "some-file.txt"
> >>
> >> Hmm. What you wrote above here makes sense, but I agree with the
> >> original change from Junio (CC'd) that using `--theirs` does not make
> >> sense when the source is a tree-ish and not the index directly.
> >>
> >> This is different, though, since here you are just trying to check out
> >> the contents of some-file.txt at stash@{0}, without `--theirs`. What did
> >> you mean in the previous example, and why was `--theirs` necessary in
> >> the call there?
>
> > "--theirs" was necessary since I want the file exactly as it is in the
> > stash - any conflicts from applying the file from stash should be
> > automatically resolved using the hunk from the stash
>
> But "--theirs" is to take their version unconditionally, isn't it?
> There is no "if conflicted take theirs", or "take theirs only in
> conflicted parts, but otherwise take a natural merge result". At
> least, I do not recall writing the code to behave that way.
>
> So I am not sure if you are getting what you _think_ you are gettin
> by passing "--theirs".
>