Reputation: 486
I'm new in git and ruby on rails, i'm trying to recover an other day work with git, so I type "git log" and i can see my "commits" for the repository in my application directory:
commit 016a8807427c46087762b56e1ea02abc
Author: Antonio
Date: Mon Feb 4 11:32:32 2013 +0100
session errors
commit cc3c292ffd110414cf4db54c5b976f2f
Author: Antonio
Date: Sun Feb 3 21:02:59 2013 +0100
hw2_c
commit af2a509d462e454d0315c63ce98ad6d0
Author: Antonio
Date: Sun Feb 3 20:34:55 2013 +0100
hw2_elementsId
commit 2314687a32c7f56ff8fc8557d95af3df
Author: Antonio
Date: Sun Feb 3 20:25:23 2013 +0100
hw2_b
But when i try to checkout any commit, I receive always the same error message:
git checkout hw2_c
error: pathspec 'hw2_c' did not match any file(s) known to git.
Can anyone help me?
Upvotes: 0
Views: 899
Reputation: 225162
You can't check out a commit by its message. You need to check out using the hash:
git checkout cc3c292ffd110414cf4db54c5b976f2f
If you want a symbolic name, make a branch or tag at that hash:
git branch hw2_c cc3c292ffd110414cf4db54c5b976f2f
git tag hw2_c cc3c292ffd110414cf4db54c5b976f2f
Upvotes: 1