๐ŸŽ“ A1Learner
๐Ÿ”
0 of 50 lessons completed

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 apply

The stash is still saved

Apply does not drop the stash. It stays in the list.

$ git stash list

Drop it when it is done

The second list prints nothing. The stash is gone.

$ git stash drop
$ git stash list

Example

$ git stash apply
$ git stash drop

Key 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?