0

I had a lot of changes in my local repository that were not committed , and I stashed them. I then pulled using git pull -r origin master and tried to pop my stashed changes after the pull completed. This let to my error:

error: unable to create file src/app/...: Permission denied

I was the one who created the file in the first place, so I don't know why it's telling me that I don't have permissions to create it again. I'm looking at maybe a couple of avenues here:

  1. Is there a way to revert to a specific stash so i can get my code back? I have the stash number.
  2. Is there a way to get local changes from somewhere on my computer before the stash?

I have already looked in the local changes of the version control tab in Intellij for the file. It's there, but several weeks old, and doesn't have my most recent changes (I modified the file yesterday).

I'm hoping that I can get an answer here, because I will be losing weeks of work that will take me a while to get back... Thanks!

Quinn Luck
  • 1
  • 1
  • 2

1 Answers1

0

I figured it out. Here's the link:

How to recover a dropped stash in Git?

Since my git stash resulted in an error, the reference of the commit was still stored in .git/refs/stash. I then used Dolda2000's answer and created a temp branch using:

git branch tmp <first 7 characters of ref #>

switched to the tmp branch and I was able to find my lost file.

Quinn Luck
  • 1
  • 1
  • 2