Home > Enterprise >  get stash restore error: pathspec with Powershell
get stash restore error: pathspec with Powershell

Time:03-14

As suggest here https://github.com/dahlbyk/posh-git/issues/106 I used

git restore 'stash@{0}' --

but still get

error: pathspec 'stash@{0}' did not match any file(s) known to git

So is there another way ?

CodePudding user response:

You want git restore --source=stash@{0} (which will require adding single quotes or whatever as usual for PowerShell). That is, your mistake here is leaving out --source=.

Worth noting: stash@{0} and stash have exactly the same meaning, so there's no need to add the @{0} part. If you leave it out, you won't run into PowerShell's special meaning for braces either, and won't need single quotes. So

git restore --source=stash

is considerably easier. The lack of a pathspec will make git restore fail, though, so you will also need to decide which file(s) to restore from source stash.

  • Related