Git stash fails 'error: unable to resolve reference refs/stash: No such file or directory'

扶醉桌前 提交于 2019-12-18 03:39:22

问题


Git pull command is working fine, but git stash is giving the following error:

$git stash
error: unable to resolve reference refs/stash: No such file or directory
fatal: Cannot lock the ref 'refs/stash'.
Cannot save the current status

How do i resolve this so that i don't loose my changes?


回答1:


I was having a very similar issue, after a corrupted filesystem.

The solution was to remove the file or directory at .git/logs/refs/stash

After delete the file or directory, plase use git stash to create a new ref, and thats all.

This will delete any stash you might have, so please be careful.

git stash
error: refs/stash does not point to a valid object!
rm -r .git/logs/refs/stash
git stash
Saved working directory and index state WIP on master: e1d74d8 fixing get_thumbnail_list



回答2:


I had to delete following file also to get it working.

rm -f .git/refs/stash



回答3:


You can remove the stash and add new stash folder if the problem still remained after remove the stash:

rm -r .git/logs/refs/stash

mkdir .git/logs/refs/stash



来源:https://stackoverflow.com/questions/18480174/git-stash-fails-error-unable-to-resolve-reference-refs-stash-no-such-file-or

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!