how to undo "git checkout" from a specific commit and go back to the last commit I did before checkout

Asked

Viewed 1,795 times

2

I need to get back to the environment I was before I realized git checkout id_commit but when I execute git log no longer appear the commits I realized after the checkout. In the remote repository appear all push that I gave, there’s a way I could leave the local rep just like the remote rep and go back to the last commit that I gave?

inserir a descrição da imagem aqui

1 answer

6


Try using git reflog. You should have a listing like:

220981e HEAD@{0}: checkout: moving from master to 220981e
239b47a HEAD@{1}: checkout: moving from c_api to master

This indicates that at the last checkout I was on the branch master went to commit 220981e. To go back to where I was.

git checkout master
  • I wanted to go back to e655486 HEAD@{3}: commit: going back to the commit I was doing the pdf via PHP do you have how? I gave git checkout master but I still haven’t been able to return to the environment I was before

Browser other questions tagged

You are not signed in. Login or sign up in order to post.