Apply any stashed content to the current working directory

<

arti­cle class=“markdown-body”>

When you run git stash, you take all the pend­ing changes from your local direc­tory (includ­ing the state) and move it to a tem­po­rary stack-like struc­ture called the stash. You can keep stash­ing changes and the stash keeps fill­ing up.

I say that the stash is a stack-like struc­ture because although you can do a git stash pop, you still have the abil­ity to take out any item in the stash and not nec­es­sar­ily the lat­est one.

The sim­plest way is to list the stash and then apply a par­tic­u­lar item in the stash by pass­ing in an index. For exm­ple, the below com­mand applies the changes in the stash index ‘3’ to the cur­rent work­ing directory

git stash list
# This displays a list of all the available stashes
git stash apply stash@{3}

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *