git stash apply stash@{<number>}

Apply a specific stash to the working directory

This command applies a specific stash to the working directory. Stashes are stored as a stack, with the latest stash at the top. By specifying the parameter, you can indicate which stash you want to apply. The stash@{} syntax allows you to reference a specific stash.

After applying the stash, the changes will be reapplied to the working directory, but the stash itself will still exist.

Some potential variations of this command include:

  • git stash apply stash@{0}: Applies the most recent stash
  • git stash apply stash@{2}: Applies the stash with the index '2' from the stash stack
  • git stash apply --index stash@{1}: Applies the stash with the index '1' and also tries to restore any changes added to the index
Manual page
git stash
Related commands

Welcome to GitExamples!

Sign in to enable bookmarking, reminders, progress-tracking and more...