Git stash适用并放弃

Kir*_*eck 31 git

是否有一个git命令都应用存储并删除它?

这是一个命令:

git stash apply
git stash drop
Run Code Online (Sandbox Code Playgroud)

Ada*_*ght 56

你想要的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.
Run Code Online (Sandbox Code Playgroud)

  • 请注意,如果由于"git stash pop"而发生冲突,则不会删除存储.一旦冲突得到解决(并且最好是承诺),您就需要自己放下藏品. (10认同)

ell*_*eth 15

git stash pop将获取列表中的第一个存储(或您指定的存储),将其应用于您HEAD的存储,并从存储列表中删除它.