FAQ: How to Backtrack - git reset II

This community-built FAQ covers the “git reset II” exercise from the lesson “How to Backtrack”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn Git

FAQs on the exercise git reset II

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Can we go back to any previous commits by just referencing the 7 characters from the SHA?

What’s the difference between git reset HEAD and git reset ?

2 Likes

Hi,
I am stuck in the second step of “exercise git reset II”.

Q. 2) From the terminal, enter the command to reset to a previous commit, using the first 7 characters of one of the past commit SHAs in your Git log.

Thanks in advance.

2 Likes

Is it me or does this exercise not work?

For all who are stuck here.
If you do not see $ appearing, please press q. Then you can reset.

4 Likes

Hi, I was also stuck on the second step. I was just typing random things to move on because the “get unstuck: solution” option was not working for me. I’m not sure why this worked, but it did, and I hope it helps anyone else that’s stuck!

  1. git log
  2. q (to reset)
  3. git reset 5c04eef
  4. git log
  5. git reset d640dc3
3 Likes

Hi my friend. Some considerations here

  1. “q” is to exit from log
  2. use git log and git status to see how it cheages. Also you can use “nano” to see how files content changes

Let me know

1 Like

it works!
let me know

what happened my friend!?

Try typing the 7 SHA code characters each manually rather than copying and pasting them, It worked for me.:blush::blush:

You can use command git log --oneline, it will give better visibility.

If the 2nd exercise is not working for you, just keep doing the reset on all the commits, it worked for me after doing the reset on the last commit instead of the most recent commit.

3 Likes

“q” does not work for me either. It does not reset the exercise at all and no matter what I do it’s not working. Not sure why

Yeah, thanks, for this!
q ENTER
write the command manually (not ctrl+v).
That s ok for me.

that worked for me thanks

Couldn’t get this to work initially, it didn’t seem to work when I entered the most recent commit, so I tried a previous one and this worked.

I can’t seem to get this to work at all. Help would be appreciated.

Thanks! For me also the most recent commit did not work, but worked 7 numbers from the oldest commit.

OK, I think I got it finally.
To get rid of LAST commit (or any other) you have to write 7 first digits of commit BEFORE LAST commit.