有没有一种简单的方法可以切换回到当前分支之前的最近所在的分支?这与命令行中的“cd -”概念相同。
在处理多个分支时,这非常有用。
有没有一种简单的方法可以切换回到当前分支之前的最近所在的分支?这与命令行中的“cd -”概念相同。
在处理多个分支时,这非常有用。
只需执行:
git checkout -
cd -
。如果不是 @KlasMellbourn 的回答,我可能永远都找不到这个方法,但实际上在git-checkout(1)的手册页中已经提到了(在描述<branch>
部分):
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}".