Git stash适用并放弃

时间:2013-02-08 17:51:21

标签: git

是否有git命令同时应用存储并将其删除?

这是一个命令:

git stash apply
git stash drop

2 个答案:

答案 0 :(得分:48)

你想要git stash pop

pop [--index] [-q|--quiet] [<stash>]
       Remove a single stashed state from the stash list and apply it on
       top of the current working tree state, i.e., do the inverse
       operation of git stash save. The working directory must match the
       index.

答案 1 :(得分:12)

git stash pop会占据您列表中的第一个存储区(或您指定的存储区),将其应用到您的HEAD,并将其从存储列表中删除。