Difference between git stash pop and git stash apply

前端 未结 7 824
忘了有多久
忘了有多久 2020-11-29 14:21

I\'ve been using git stash pop for quite some time. I recently found out about the git stash apply command. When I tried it out, it seemed to work

7条回答
  •  我在风中等你
    2020-11-29 14:56

    Git Stash Pop vs apply Working

    If you want to apply your top stashed changes to current non-staged change and delete that stash as well, then you should go for git stash pop.

    # apply the top stashed changes and delete it from git stash area.
    git stash pop  
    

    But if you are want to apply your top stashed changes to current non-staged change without deleting it, then you should go for git stash apply.

    Note : You can relate this case with Stack class pop() and peek() methods, where pop change the top by decrements (top = top-1) but peek() only able to get the top element.

提交回复
热议问题