What does the git stash apply command do?

What does the git stash apply command do?

a) Applies the latest stashed changes without deleting them
b) Deletes stashed changes
c) Commits stashed changes
d) Creates a new stash

Answer:

a) Applies the latest stashed changes without deleting them

Explanation:

The git stash apply command applies the latest stashed changes back into your working directory without deleting them from the stash. This allows you to restore the saved state while keeping the stash intact for future use.

For example, if you have stashed changes and want to reapply them later, git stash apply will restore those changes while keeping the stash available.

Using git stash apply is helpful when you need to temporarily save and later restore changes during context switching.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top