我已经用了很长一段时间了。我最近发现了git stash apply命令。当我尝试它时,它似乎和git stash pop一样有效。
gitstashpop和gitstashapply之间有什么区别?
我已经用了很长一段时间了。我最近发现了git stash apply命令。当我尝试它时,它似乎和git stash pop一样有效。
gitstashpop和gitstashapply之间有什么区别?
当前回答
假设不会抛出错误,并且您希望处理可用存储列表中的顶部存储项:
gitstashpop=gitstashapply+gitstashdrop
其他回答
In git stash是一个可以移动当前更改文件的存储区域。
当您想从git存储库中提取一些更改并检测到git repo中可用的一些共同文件中的一些更改时,隐藏区域非常有用。
git stash apply //apply the changes without removing stored files from stash area.
git stash pop // apply the changes as well as remove stored files from stash area.
注意:-git apply只应用存储区中的更改,而git pop apply则应用并从存储区中删除更改。
假设不会抛出错误,并且您希望处理可用存储列表中的顶部存储项:
gitstashpop=gitstashapply+gitstashdrop
快速回答:
git stash pop->从隐藏列表中删除
git存储应用->将其保存在存储列表中
git stash pop在应用后丢弃(默认情况下是最上面的)存储,而git stashapply将其保留在存储列表中,以便以后重用(或者您可以将其丢弃)。
除非在git stash pop之后发生冲突,否则会发生这种情况,在这种情况下,它不会删除该stash,使其行为与git stashapply完全相同。
另一种方法是:gitstashpop是gitstashapply&&gitstashdrop。
gitstashpop应用顶部隐藏的元素并将其从堆栈中移除。git stash apply也会这样做,但会将其留在stash堆栈中。