Let have a file a
tracked by git and modified locally.
Moreover, that file was in the stash too.
Then:
If you did it git stash pop
, see this link
If accidentally you did only this git checkout a
you've lost.
That discards all changes in a file.
How to undo this operation?
I don't see this operation in reflog
.
Stash after pop doesn't exist (not listed), but does any of that history is available somewhere in .git
directory?
reflog
only keeps track of when a tip of branch has been updated so I wouldn't expect to see your changes there.
From the doc:
Reference logs, or "reflogs", record when the tips of branches and other references were updated in the local repository.
Sorry to say that using checkout
in this situation means those changes are lost.
stash
can be a safer alternative.
EDIT:
If this loss is severe, you can potentially do some digging by looking at @jthill's comment on the original question