All of lore.kernel.org
 help / color / mirror / Atom feed
* BUG? git stash and immediate git apply results in conflict
@ 2022-06-01  6:55 Akos Vandra-Meyer
  2022-06-02  6:32 ` Chris Torek
  0 siblings, 1 reply; 4+ messages in thread
From: Akos Vandra-Meyer @ 2022-06-01  6:55 UTC (permalink / raw)
  To: git

Hello!

I believe there might be a bug in how a git stash is calculated with
the -k flag.
I would expect to always be able to stash and pop a set of changes,
but if the working directory contains staged and unstaged changes for
a file, this results in a conflict.

The stashed diff shows the changes from the last commit, rather than
what is in the current working directory, so when the stash is applied
it results in a conflict, because there are staged changes in the
current working directory.

Steps to reproduce:

 mkdir test
 cd test
 git init .
 echo foo > a
 echo bar >> a
 echo baz >> a
 git add a
 git commit -m "initial"
 cat a | sed s/bar/foo2/ > a2; mv a2 a git status
 git add a
 cat a | sed s/foo2/xxx/ > a2; mv a2 a
 git status
 git stash -ku
 git stash pop

Thanks for looking into this,
  Akos Vandra-Meyer

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

end of thread, other threads:[~2022-06-02 12:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01  6:55 BUG? git stash and immediate git apply results in conflict Akos Vandra-Meyer
2022-06-02  6:32 ` Chris Torek
2022-06-02 11:31   ` Akos Vandra-Meyer
2022-06-02 12:24     ` Chris Torek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.