Reputation: 3100
I would like to revert back a specific file to before a specific commit.
I have tried the following (shortened the hash):
git checkout 76a843a~1 loginController.js
git checkout 76a843a~1 controllers/loginController.js
These produce the error:
error: pathspec 'loginController.js' did not match any file(s) known to git.
Could anyone please advice what I am doing wrong? The file is there, but I am not sure what the path is that git will accept.
Upvotes: 0
Views: 75
Reputation: 30297
You need to separate the revision and the paths with --
. try:
git checkout 76a843a~1 -- loginController.js
git checkout 76a843a~1 -- controllers/loginController.js
Or on a single shot:
git checkout 76a843a~1 -- loginController.js controllers/loginController.js
Assuming it's two different files... either way, make sure to use the right paths (casing and everything).
Upvotes: 1