How to get back to most recent version in Git?

前端 未结 10 1274

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 <

10条回答
  •  忘掉有多难
    2021-01-29 18:19

    With Git 2.23+ (August 2019), the best practice would be to use git switch instead of the confusing git checkout command.

    To create a new branch based on an older version:

    git switch -c temp_branch HEAD~2
    

    To go back to the current master branch:

    git switch master
    

提交回复
热议问题