2.43+ git checkout --theirs on stash error - no alternative?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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]




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux