git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.43+ git checkout --theirs on stash error - no alternative?
@ 2024-10-27 22:16 Devste Devste
  2024-10-27 22:31 ` Devste Devste
  0 siblings, 1 reply; 6+ messages in thread
From: Devste Devste @ 2024-10-27 22:16 UTC (permalink / raw)
  To: git

What did you do before the bug happened? (Steps to reproduce your issue)
git checkout 'stash@{0}' --theirs -- "some-file.txt"

What did you expect to happen? (Expected behavior)
Checking out the file exactly as it is in the stash with any conflicts
resolved using the stash's data

What happened instead? (Actual behavior)
fatal: '--merge', '--ours', or '--theirs' cannot be used when checking
out of a tree

What's different between what you expected and what actually happened?
Error and unresolved conflicts

Anything else you want to add:
This behavior was changed in 2.43
https://www.spinics.net/lists/git/msg463600.html
However, I think this change is wrong. Since using --theirs still
makes sense, if you want to restore a file to the exact state it was
in the stash.
While the change probably had in mind that this should be used: git
cherry-pick --no-commit --mainline 1 --strategy-option=theirs
'stash@{0}'
This leads to different results than git checkout --theirs, since it
tries to resolve the conflicts and is not correctly using "theirs" to
automatically resolve them
How can the pre 2.43 behavior be achieved?

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.43.5
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.14.0-162.23.1.el9_1.x86_64 #1 SMP PREEMPT_DYNAMIC Tue
Apr 11 19:09:37 UTC 2023 x86_64
compiler info: gnuc: 11.4
libc info: glibc: 2.34
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-11-06 10:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-27 22:16 2.43+ git checkout --theirs on stash error - no alternative? Devste Devste
2024-10-27 22:31 ` Devste Devste
2024-10-27 23:38   ` Taylor Blau
2024-11-04 10:09     ` Devste Devste
2024-11-04 10:17       ` Junio C Hamano
2024-11-06 10:16         ` Devste Devste

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 NNTP newsgroup(s).