gitpowershellgit-stashposh-git

git stash apply unknown option: -encodedCommand error


When applying a git stash with the command:

git stash apply stash@{1}

As suggested in the documentation on git stash.

I receive the error:

unknown option: -encodedCommand error

Solution

  • What I didn't realise...

    I was in powershell (to use posh-git) and of course {} is indicating powershell code.

    Therefore surrounding in '' will ensure powershell interprets it as a string.

    git stash apply 'stash@{1}'
    

    Notably posh-git autocompletes the name when pressing tab (which made me realise my error).