Unable to understand the task in Level 1 of Git (Revert)

Cannot revert to previous commit. When I try to revert, it shows there are untracked files. If I try to stash/add/commit the file and then try to revert, it shows both the commits are same.

Hi

I had also some issues with understanding whats going on. But some weeks ago I was able to made it. Here’s how:

The revert must be made with the hashing of the last commit, not the one that wants to come back. Because if you are putting that hashing , you are going to delete that commit also.

In your case you are using HEAD-1, I never tried that , but you can use the commit hashing, wihch in your case is 194d… and so on (some operations in git doesn’t need all the numbers, just the first ones).

Then you need to create the commit, by default after you do git revert “commit hashing”, the terminal must show you a vi editor, with some options. Then in the commit section (marked by quotes if I’m not wrong), you should put revert news, so the final ouput should be like this “revert news” in the commit. Sometimes in the lab this change in the second mark, as you can see, so be sure to always use the highlighted text in the second task, that should be included in the commit.

After that should be work. Also you can make a git push, just in case.

Let me know if you can do it, or have any problems. Later I will be over here, and in the worst case I could make this lab again.

It worked.
Thanks a lot.

You’re welcome! Have a nice coding day.