How to access an earlier version and then go back to the latest git checkout

Asked

Viewed 1,082 times

3

The question is simple: Imagine that I have 10 versions. I used the git checkout on Friday to quickly analyze a line.

How can I return to the latest version if her ID is missing from mine git log? How can I use the git checkout to the most current without knowing her ID since the sixth is my "current HEAD".

Thank you very much for your attention.

  • It wasn’t clear to me what happened. "git checkout master" doesn’t solve your problem?

  • I didn’t know about this command. Thank you very much for your help.

  • @Marcosbanik, as he found the answer to the AP question, how about providing an answer to the question? :)

1 answer

1

If you went to a specific commit and want to go back to the most recent commit on the branch, just double-check the branch itself:

git checkout 123456 # hash de um commit específico
git checkout nome_branch # vai para o commit mais recente da branch

If you want to return to checkout previous (not for the latest commit), you can use:

git checkout -

Which works in a similar way to cd - on Linux, going back to the directory you were previously in.

Browser other questions tagged

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