慎用git stash save -a

一直都是使用git stash來暫存臨時修改,昨天搜到了這篇文章git stash 命令 ,說是用git stash save -a會將新加入的代碼文件同時放入暫存區,我信了,結果沒想到帶來了坑,想用git stash pop恢復時竟然提示git

xxxx already exists, no checkout
Could not restore untracked files from stash

最明顯的就是Pod文件夾中的文件都提示這個錯誤,而Pod文件夾我是在.gitignore中忽略的。 .net

-a表示all,是不單單把新加入的代碼文件放入暫存區,還會把用.gitignore忽略的文件放入暫存區。若是想不影響被忽略的文件,那就要用-u,表示untracked files。
rest

相關文章
相關標籤/搜索