0

I am on branch1 --> did some changes --> did a git add, then did a git stash save --> switched to branch2 --> did some changes --> add, commit and push --> Now switch back to branch1 --> did git stash pop stash@{0} ===> My changes are gone :(

How can I restore my changes on branch1.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
prago
  • 5,225
  • 5
  • 25
  • 27
  • you lost those modification you staged in branch1? It seems that has been overwrited by staged modifications in branch2. – gzh Mar 03 '16 at 00:12
  • Nope. I didn't lost those. when I do a git stash list --> the list is showing my changes as stash@{0}. So I don't think they are lost. – prago Mar 03 '16 at 00:23
  • I means you lost staged contents,not staged contents, because you only `git add` in branch1 and did not commit it. That should be the parent node of the contents you stashed. After your operations in branch2, you lost staged contents of branch1, which make stashed contents to became orphan node, `git stash pop` do not know where to append and failed. – gzh Mar 03 '16 at 00:50

1 Answers1

0

Well I created a new branch out of stash@{0}. Don't know why git stash pop stash@{0} didn't worked in the first hand. I looked into the git tree then created a branch out of stash@{0}'s commit number. It fixed my problem. Thanks all.

prago
  • 5,225
  • 5
  • 25
  • 27