Git stash reverts some, but not all, changes

While working on Section A, a fire broke out in the office, requiring extinguishing. I didn't want to commit my changes yet. I added 2 new files and changed 7. None of the changes were delivered. I wanted to temporarily save my changes and use "git stash -a". What I really wanted was the -u switch, but -a was misused. My entire project was stashed and my branch recovered as expected to the last commit.

I switched to branch B, did some work and did it.

Then I switched back to Branch A and called 'git stash pop'. Many duplicate lines are scrolled by reading "[file_name] already exists, no validation" and then exits with the message "Failed to recover unused files from stash". A look at my branch showed that 2 unprocessed files were recovered, but 7 hadn't changed. 'git status' shows 2 unapproved files and no other changes. Since I hid the whole project, it compares about 1500 files, so I don't know what the comparison result with 7 changed files shows ... it scrolls the buffer.

The 'git stash list' shows the wallet still has an entry: "stash @ {0}: WIP on Branch A: ffef125 [last commit message]"

'git stash show' does indeed show my 7 changed files in stash, but when I 'w20> stash pop', these files are not restored and the write stays in stash (which is not what I expected of pop)

I wondered if there was some sort of merge conflict with the 7 changed files, but there are no conflict resolution markers in any of them.

Why can't I recover 7 changed files and what's the workaround? And on the side of the note, why does git say it was unable to recover unused files when in fact those are the things that were restored?

+3


source to share


1 answer


The problem has been resolved.

I solved this problem with



  • Checking a stamp branch
  • Copying the files I need to the temp directory
  • Checking out my original working branch
  • Copying the reserved files to my working branch

It is not entirely clear why the problem occurred in the first place. Based on the conversations I've had with people more git-fluent than I am, it might have to do with the fact that the last commit was a merge and that I didn't commit any changes. But again, this is pure hypothesis.

0


source







All Articles