Git结帐:“@ { - N}”句法 [英] Git checkout: "@{-N}" syntax
问题描述
作为一种特殊情况,@是一个特殊情况, {-N}语法为第N个最后分支
检出分支(而不是分离)。您也可以指定
- 这与@ { - 1}同义。
这是什么意思? / p>
这就是说,如果你这样做的话:
git checkout @ { - 1}
你会看看你的分支在当前分支之前,您已经签出。另外,它通过名称检查它,所以你实际上将该分支放在上,而不仅仅是检查在分离HEAD状态下的提交。同样,您可以使用 git checkout @ { - 2}
返回前两个分支更改,等等。
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 branch checks out the branch (instead of detaching). You may also specify - which is synonymous with "@{-1}".
What does it mean?
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.
这篇关于Git结帐:“@ { - N}”句法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!