Interview Prep/Git & GitHub/Commits, branches and tags

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

IntermediateConceptCommits, branches and tags
Answer

pop applies the stash and drops it if it applies cleanly. apply leaves the stash in the list so you can apply it to more than one branch. If pop hits conflicts the stash is kept, which prevents loss.

git stash apply stash@{2}
git stash drop stash@{2}
git stash branch fix-login stash@{0}
All Git & GitHub questions Roadmap: Git & GitHub

More on Commits, branches and tags