image credit: ancientking
Why?
A git stash
is a very powerful concept, it’s like Harry Potter’s Room of Requirement for your code, you throw it in here and you can get it back when you need it again in the future.
But dealing with it can be dangerous.
Running git stash pop
throws away the stash after applying it.
git stash apply
leaves it in the stash list and can be reused later (or dropped using git stash drop
)
note: If during a
pop
there are conflicts it behave exactly like git stash apply and the stash will not be lost
Worth notice
git stash pop
is equivalent to git stash apply && git stash drop
Conclusion
git stash apply
can be a life-saver somethimes when you mess up with taking something from the stash
Blog by Jaga Santagostino.
Software consultant, polyglot developer, maker of things, lifelong learner.
ReactJS Milano & milano.dev organizer