Git stash彷佛作了我想要的不少事情,除了編寫腳本有些困難,由於若是沒有任何更改,則使用git stash; git stash pop
git stash; git stash pop
與存儲庫中所作的更改會有所不一樣。 git
看來git stash create
是解決該問題的方法,而且一切正常,除了一件事……我沒法擺脫建立的stash。 有什麼辦法擺脫藏匿處嗎? app
爲了使其100%清楚我在作什麼: spa
建立存儲: 3d
~/tmp/a(master) $ git stash create 60629375d0eb12348f9d31933dd348ad0f038435 ~/tmp/a(master) $ git st # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: b # ~/tmp/a(master) $ git reset --hard HEAD is now at 555d572 log message
使用隱藏: 日誌
~/tmp/a(master) $ git apply 60629375d0eb12348f9d31933dd348ad0f038435 fatal: can't open patch '60629375d0eb12348f9d31933dd348ad0f038435': No such file or directory ~/tmp/a(master) $ git stash apply 60629375d0eb12348f9d31933dd348ad0f038435 # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: b #
刪除存儲:(除了最後一點不起做用) code
~/tmp/a(master) $ git stash drop !$ git stash drop 60629375d0eb12348f9d31933dd348ad0f038435 '60629375d0eb12348f9d31933dd348ad0f038435' is not a stash reference
若是您100%確保只有一個存儲區, 或者要刪除全部 git stash list
(請確保git stash list
肯定爲107%),則能夠執行如下操做: 圖片
git stash clear
..而後忘記它們(它將刪除全部存儲)。 ci
注意:爲那些最終在這裏尋找全部方法的人(如我)添加了此答案。 get
來自git doc: http : //git-scm.com/docs/git-stash hash
放下[-q |-安靜] []
從存儲列表中刪除單個存儲狀態。 若是沒有給出,它將刪除最新的。 即stash@{0}
,不然必須是形式爲stash @ {}的有效隱藏日誌引用。
例:
git stash drop stash@{5}
這將刪除存儲項5。要查看全部存儲項列表,請執行如下操做:
git stash list
也能夠
git stash drop <index>
喜歡
git stash drop 5
該文件在這裏(中文), 請單擊。
您可使用
git存儲列表
git stash drop stash @ {0}
git stash drop
不帶參數-會刪除頂部的stash-或相似於stash@{n}
的stash引用,其中n
指定要刪除的stash。 您不能將提交ID傳遞給git stash drop
。
git stash drop # drop top hash, stash@{0} git stash drop stash@{n} # drop specific stash - see git stash list
放下存儲區將更改堆棧中全部stash@{n}
名稱。
我不肯定爲何您認爲須要刪除存儲,由於若是您使用stash create
則不會爲您的「存儲」 stash create
存儲條目,所以沒有要刪除的內容。