git stash pop 与 git stash apply 的区别

2,272 阅读1分钟

git stash pop 命令会在 stash 应用之后丢弃(默认情况下指的是最顶部的)stash,而 git stash apply 会将其保留在存储列表中,以备日后重用(或者您可以在之后使用 git stash drop 命令移除此 stash)。

除非 git stash pop 之后存在冲突,在这种情况下,它将不会删除该 stash,而使其行为与git stash apply 的命令完全相同。

当然,我们也可以使用另一种方式来实现 git stash pop,那就是:git stash apply && git stash drop