I am trying to reset two files in my repository back to HEAD state using git, but I receive the following error:
error: pathspec 'package-lock.json' did not match any file(s) known to git.
I am extremely confused because when I run git status
the files show up as having been modified, so they're definitely there. I found a blog post that suggests the file tree may have been changed but I haven't changed any file or folder names or positions.
Please advise!
code reproduction:
git status
returnspackage-lock.json
andsrc/react-app-env.d.ts
git reset HEAD package-lock.json src/react-app-env.d.ts
runs with no issue and unstages the two filesgit checkout HEAD -- src/react-app-env.d.ts package-lock.json
gives the following error:error: pathspec 'src/react-app-env.d.ts' did not match any file(s) known to git. error: pathspec 'package-lock.json' did not match any file(s) known to git.