git stash save -a "message"遇到的坑


git stash 存放在緩沖區的意思。

大致的用法有這幾個命令:

1.git stash / git stash save "message" / git stash save -a "message"(慎用)

2.git stash pop [ stash@{id} ] / git stash apply [ stash@{id} ]    apply不刪除緩存里的,pop刪除即彈出來了就不存在了

3.git stash list 看哪個文件不同

4.git stash show 看文件diff不同

5.git stash clean 清除緩沖區

剛剛手(shou)滑(jian),居然用了git stash save -a 命令!

它會把gitignore里的東西都放進去!!!切回來的時候,告訴你xxx already exists, no checkout Could not restore untracked files from stash

!!!

存在了,那就恢復不了了。

在stackoverflow看到一個解決辦法:

1.把項目里exists的東西刪除掉,用git clean -f / git clean -fdx命令,基本上都是.gitignore里的東西。刪完就好了

2.接下來,可以用:git stash pop stash@{id}命令來進行恢復了。

其他的方法看不懂,什么git stash branch 巴拉巴拉的。這個比較簡單。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM