Apply a Stash
Apply brings a stash back into the files. The stash stays saved until you drop it.
Bring the stash back
The sugar line returns to the files as an unstaged change.
$ git stash applyThe stash is still saved
Apply does not drop the stash. It stays in the list.
$ git stash listDrop it when it is done
The second list prints nothing. The stash is gone.
$ git stash drop
$ git stash listExample
$ git stash apply
$ git stash dropKey points
- Apply with no names brings back the newest stash.
- The changes return as unstaged changes.
- The stash stays in the list after an apply.
- Pop brings the stash back and drops it in one step.
- Drop deletes a stash you no longer need.
- Apply the stash on the branch where the work belongs.
Here, apply returns the sugar line. Drop removes the stash, since the work is back in the files.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
What stays after git stash apply?