How do I use ‘git reset –hard HEAD’ to revert to a previous commit? [duplicate]

I know that Git tracks changes I make to my application, and it holds on to them until I commit the changes, but here’s where I’m hung up:

When I want to revert to a previous commit I use:

git reset --hard HEAD

And Git returns:

HEAD is now at 820f417 micro

How do I then revert the files on my hard drive back to that previous commit?

My next steps were:

git add .
git commit -m "revert"

But none of the files have changed on my hard drive…

What am I doing right/wrong?

2 s
2

Leave a Comment