git - 如何在同一命令中应用和删除最新的 git stash?

标签 git

看来,当我执行 git stash apply 时,我需要输入 git stash drop 以便从可用的存储中删除该存储。我可以在一个命令中执行此操作吗?

最佳答案

git stash pop 就是您要找的。作为man page说:

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.

    Applying the state can fail with conflicts; in this case, it is not
    removed from the stash list. You need to resolve the conflicts by hand
    and call git stash drop manually afterwards.

关于git - 如何在同一命令中应用和删除最新的 git stash?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11351756/

相关文章:

特定存储库的 Git 全局配置?

git - go build 不起作用,因为 git 在 Linux 上被对等方重置了致命的读取错误连接

git - 在网站上使用 git 源代码管理

git - 在 git 中取消暂存新文件部分的最快方法是什么?

ruby - Gemfile.lock 应该包含在 .gitignore 中吗?

java - 同步两个java项目的最佳方法是什么?

git - 误推master后如何恢复

git svn fetch 然后提交到远程git

git - 如何删除使用递归 .../** 模式 .gitignored 的文件?

git pull 在两个不同的 origin/master 分支之间交替