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
存储条目,所以没有要删除的内容。