I'm confused. I want to go back to a previous commit that I identified in "git log".
But when I do "git checkout ", I don't get said commit. Nothing changes. It tells me I'm in detached HEAD mode, but the files I want are not there.
What the eff am I doing wrong?
MrB
git reset --hard This command reverts the repo to the state of the HEAD revision, which is the last committed version. Git discards all the changes you made since that point. Use the checkout command with two dashes, then the path to the file for which you want to revert to its previous state.
git reset --hard <commit>
From the manpage:
Matches the working tree and index to that of the tree being switched to. Any changes to tracked files in the working tree since are lost.
git checkout
is for switching your working directory to a different branch or commit. This does not move the HEAD
there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With