Git结帐:“@ { - N}”句法 [英] Git checkout: "@{-N}" syntax

查看:75
本文介绍了Git结帐:“@ { - N}”句法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


作为一种特殊情况,@是一个特殊情况, {-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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆