Git 取消储藏(Un-applying a Stash)

在某些情况下,你可能想应用储藏的修改,在进行了一些其他的修改后,又要取消之前所应用储藏的修改。Git没有提供类似于 stash unapply 的命令,但是可以通过取消该储藏的补丁达到同样的效果:

$ git stash show -p stash@{0} | git apply -R

同样的,如果你沒有指定具体的某个储藏,Git 会选择最近的储藏:

$ git stash show -p | git apply -R

你可能会想要新建一个別名,在你的 Git 里增加一个 stash-unapply 命令,这样更有效率。例如:

$ git config --global alias.stash-unapply '!git stash show -p | git apply -R' $ git stash apply $ #... work work work $ git stash-unapply

REF:http://cwiki.ossez.com/pages/viewpage.action?pageId=7045536