Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.4k points)

I have recently moved from SVN to Git and am a bit confused about something. I needed to run the previous version of a script through a debugger, so I did git checkout <previous version hash> and did what I needed to do.

Now I want to get back to the newest version, but I don't know the hash for it. When I type git log, I don't see it.

How can I do this? Also, is there an easier way to change versions than by typing out hashes - something like "go back two versions" or "go to the most chronologically recent"?

1 Answer

0 votes
by (119k points)

To create a new branch depending on an older version:

git switch -c temp_branch HEAD~2

To go back to the current master branch:

git switch master

Also, check out this Git Tutorial to know more.

Browse Categories