Git checkout: “@{-N}” syntax

前端 未结 2 848
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-16 10:37

I found this section in the git manpage, but it\'s kind of an obfuscated explaination:

As a special case, the \"@{-N}\" syntax for the N-th last branc

2条回答
  •  情书的邮戳
    2021-01-16 10:54

    It's saying that if you do:

    git checkout @{-1}
    

    You'll check out the branch you were on before the current branch you have checked out. In addition, it checks it out by name, so you'll actually be on that branch, rather than just checking out that commit in a detached HEAD state. Similarly, you could use git checkout @{-2} to go back "two branch changes ago", and so forth.

提交回复
热议问题