I cannot apply stash back to the working directory.
Little story:
First I tried to push some committed changes, but it said: "no you can't, pull first"... OK then, I'll pull things from GitHub and then push my changes. When I tried to pull, it said that I had changes that would be overwritten, and that I should stash my changes. OK, I stashed the changes... did the pull, and push the committed changes. But now, I cannot restore the uncommitted changes I was working on.
This is the error:
MyPath/File.cs already exists, no checkout
Could not restore untracked files from stash
For sure I don't yet understand all the concepts of git, they confuse me a bit... maybe I did something wrong.
It would be great if someone could help me solve this... I've been searching google and everything for more than an hour now, and I didn't come to a solution yet.
Help is much appreciated. Thanks!
It sounds like your stash included an untracked file that was subsequently added to the repo. When you try and check it out, git rightly refuses because it would be overwriting an existing file.
To fix, you could do something like deleting that file (it's okay, it's still in the repo), applying your stash, and then replacing the stashed version of the file with the in-repo version as appropriate.
Edit: It's also possible that the file has only been created in the working tree without having been added to the repo. In this case, don't simply delete the local file, rather: