All of lore.kernel.org
 help / color / mirror / Atom feed
* Newbie question: Is it possible to undo a stash?
@ 2008-05-14 19:56 Iván V.
  2008-05-14 20:42 ` Jakub Narebski
  2008-05-14 20:51 ` Jean-Luc Herren
  0 siblings, 2 replies; 3+ messages in thread
From: Iván V. @ 2008-05-14 19:56 UTC (permalink / raw)
  To: git

Hi,

I just did a git stash, and then changed my mind and ran git apply,
thinking that would get me back to where I was...

Now I have lots of conflicting merges and files that came back from
the dead (and some files seem lost)... I've been trying to go step by
step to try to get the tree to where it was, but it's very
complicated, so I was wondering if there is anything I can do to get
my working tree exactly to where it was before I ran git stash...

Thanks!

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

* Re: Newbie question: Is it possible to undo a stash?
  2008-05-14 19:56 Newbie question: Is it possible to undo a stash? Iván V.
@ 2008-05-14 20:42 ` Jakub Narebski
  2008-05-14 20:51 ` Jean-Luc Herren
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2008-05-14 20:42 UTC (permalink / raw)
  To: Iván V.; +Cc: git

"Iván V." <elterrible@ivanyvenian.com> writes:

> I just did a git stash, and then changed my mind and ran git apply,
> thinking that would get me back to where I was...

You meant "git stash apply" here, didn't you?
 
> Now I have lots of conflicting merges and files that came back from
> the dead (and some files seem lost)... I've been trying to go step by
> step to try to get the tree to where it was, but it's very
> complicated, so I was wondering if there is anything I can do to get
> my working tree exactly to where it was before I ran git stash...

To get your working tree and index to exact state as it was before
git-stash, you have first to bring current HEAD to the state it was
when you did the stash.  So if you changed branch, you have to change
it back; if you did any commits, you have to rewind (reset) it.

If the "base" state isn't the same as it was during "git stash", then
"git stash apply" would have to do a merge... which can fail...


P.S. Please provide with the exact (best if minimal) sequence of
commands, if you want for us to dianoze if there is a bug in git, or
user error.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

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

* Re: Newbie question: Is it possible to undo a stash?
  2008-05-14 19:56 Newbie question: Is it possible to undo a stash? Iván V.
  2008-05-14 20:42 ` Jakub Narebski
@ 2008-05-14 20:51 ` Jean-Luc Herren
  1 sibling, 0 replies; 3+ messages in thread
From: Jean-Luc Herren @ 2008-05-14 20:51 UTC (permalink / raw)
  To: "Iván V."; +Cc: git

Hello!

Iván V. wrote:
> I just did a git stash, and then changed my mind and ran git apply,
> thinking that would get me back to where I was...

Certainly you mean "git stash apply".  "git apply" is something
different.

> Now I have lots of conflicting merges and files that came back from
> the dead (and some files seem lost)... I've been trying to go step by
> step to try to get the tree to where it was, but it's very
> complicated, so I was wondering if there is anything I can do to get
> my working tree exactly to where it was before I ran git stash...

git stash pop --index

I think that should get you exactly where you were before "git
stash".  The --index makes it also restore the index, which
wouldn't happen by default.  Using 'pop' instead of 'apply' makes
it remove the stash after re-applying it.

jlh

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

end of thread, other threads:[~2008-05-14 20:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-14 19:56 Newbie question: Is it possible to undo a stash? Iván V.
2008-05-14 20:42 ` Jakub Narebski
2008-05-14 20:51 ` Jean-Luc Herren

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.