How to get back to most recent version in Git?

前端 未结 10 1073

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:17

    I am just beginning to dig deeper into git, so not sure if I understand correctly, but I think the correct answer to the OP's question is that you can run git log --all with a format specification like this: git log --all --pretty=format:'%h: %s %d'. This marks the current checked out version as (HEAD) and you can just grab the next one from the list.

    BTW, add an alias like this to your .gitconfig with a slightly better format and you can run git hist --all:

      hist = log --pretty=format:\"%h %ai | %s%d [%an]\" --graph
    

    Regarding the relative versions, I found this post, but it only talks about older versions, there is probably nothing to refer to the newer versions.

提交回复
热议问题