Are the commands git stash apply and git stash pop the same

261    Asked by ChristopherPaterson in Python , Asked on Jul 4, 2021

 Are the commands git stash apply and git stash pop the same or not? What's the difference?

Answered by Ashish Sinha

 They are almost similar except the fact that git stash pop throws away the (topmost, by default) stash after applying it, whereas git stash apply leaves it in the stash list for possible later reuse (or you can then git stash drop it).


Git Stash Pop (Reapplying Stashed Changes)

Git allows the user to re-apply the previous commits by using git stash pop command. The popping option removes the changes from stash and applies them to your working file. The git stash pop command is quite similar to git stash apply.

Git stash apply

git stash temporarily shelves (or stashes) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on.



Your Answer

Interviews

Parent Categories