0

I'm sorry if the solution is trivial, but I'm not a GIT expert and I didn't find anything on the internet.

I stashed some changes, and I'm having hard times at reverting them. Maybe I sent the git stash command twice, I hope this didn't make me lose everything.

According to this question and official documentation, I've tried the following commands:

git stash pop

And I received:

src/schema/schema-generator2.js: needs merge
unable to refresh index

So I tried:

git merge
error: Merging is not possible because you have unmerged files

Then I tried:

git stash apply stash@{0}
unknown option: -encodedCommand
git stash apply
src/schema/schema-generator2.js: needs merge
git stash apply --index
src/schema/schema-generator2.js: needs merge
git stash show -p stash@{0} | git apply -R
git : Too many revisions specified: 'stash@' 'MAA=' 'xml' 'xml'
In riga:1 car:1
+ git stash show -p stash@{0} | git apply -R
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Too many revisi...A=' 'xml' 'xml':String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
error: unrecognized input

In the above text I wrote as code the message, and as quote the answer. I hope it's clear.

I don't understand what's happening, why nothing works? What can I do to un-stash my changes?

torek
  • 448,244
  • 59
  • 642
  • 775

1 Answers1

0

Looks like the problem is the stashed changes and latest HEAD of your branch are not automatically mergable, specifically in src/schema/schema-generator2.js file

This means you will have to manually resolve the merge conflicts

The best way to do this would be to convert the stashed changed into a patch file and try applying the patch file. You will still see the merge conflicts but will have better control of resolving the changes

$ git stash show -p --color=never > my-stashed-changes.patch
# This should show the same merge error
$ git apply my-stashed-changes.patch
# modify the patch file to resolve conflicts and apply again
rajeshnair
  • 1,587
  • 16
  • 32