Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+4 votes
2 views
in DevOps and Agile by (29.3k points)

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 the same as git stash pop.

What is the difference between git stash pop and git stash apply?

1 Answer

+5 votes
by (50.2k points)
edited by

 see these commands 

git stash pop

Throws away the stash after applying it, 

whereas git stash apply leaves it in the stash list for possible later reuse.

This happens unless there are conflicts after git stash pop, in which case it will not remove the stash, leaving it to behave exactly as git stash apply.

This happens unless there are conflicts after git stash pop, in which case it will not remove the stash, leaving it to behave exactly as git stash apply.

There is one more way to look at git stash pop is 

git stash apply 

&& 

git stash drop

Hope this helps to resolve your problem.

For more commands like this please go through the following tutorial that will help you understand the git

Related questions

0 votes
1 answer
0 votes
2 answers
asked Jul 24, 2019 in DevOps and Agile by chandra (29.3k points)
+6 votes
2 answers
0 votes
1 answer
asked Aug 2, 2019 in DevOps and Agile by Han Zhyang (19.7k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...