因为需要切换分支开发新功能,因此需要暂时储藏当前分支feature-22
,git stash -h查看了下命令说明
git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [<message>]
根据提示,想当然地使用了git stash save -a "message"
在新建分支开发完提交之后,切换回feature-22
分支,使用git stash apply 命令应用储藏时,提示下面异常,不能正常应用之前储藏的代码。
XXXX.class already exists, no checkout
XXXX.class already exists, no checkout
Could not restore untracked files from stash
根据异常,查到一篇博文Could not restore untracked files from stash —— git stash -a 之后的事故处理
可能场景不太一样,按照步骤但是没有达到想要的效果,找其他的文章解决方案也和这个差不多,没找到其他的解决方案。
此时有点慌了,因为之前储藏的代码有点多,要是重写估计得撞墙。
仔细看了下错误提示,除了最后一句,都是提示XXXX.class already exists, no checkout
,就想既然提示这些文件已