Explore Courses Blog Tutorials Interview Questions
+5 votes
in DevOps and Agile by (29.3k points)
edited by

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?

1 Answer

+6 votes
by (50.2k points)
edited by

Sometimes, this error occurs when you don't initialize the git to that folder (which you are currently working on)

so try:

git init 

For more information about installation of git and common git commands please go through the following link:

Browse Categories