Git Examples logoGit Examples
ListCheatsheetReviewQuizRecipesStatsSearch

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
Related commands

    git stash

    git stash drop

    git stash pop

    git stash push -m <message>

    git stash save <message>

    git stash -k

    git stash -u

    git stash clear

    git stash show -p

    git stash --keep-index

    git stash apply

    git stash push -p -m <message>

Follow me for updates: @carlesandres
ListReviewSearch

Welcome to GitExamples!

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

Welcome to Git Examples

Git Examples is the quick way to get better at Git.

Git by Example

With more than 100 examples, you can always find a new Git secret.

Bookmark

Bookmark commands to create a personalized cheatsheet that you can print.

Deep Dive

Learn more about any Git command by clicking on the command name.

Mark for Review

Mark commands for review to revisit them later.

Take a quiz

Test your knowledge with a fun quiz.