How to checkout a local branch from a remote's one with the same name?

时间:2018-05-09 02:49:57

标签: git android-studio

Is there anyone knows how to
checkout a local branch from a remote's one with the same name with more convenient command?

I usually do it by typing remote branch's name in param manually

Ex: git checkout -b remotebranchName origin/remotebranchName

Or do it in Android Studio by
Check out as a new remote branch enter image description here

Is there any short equivalent command in Git ? Thanks a lot

1 个答案:

答案 0 :(得分:0)

是的简短版本是:

git checkout remotebranchName 

magic command %load中所述:

  

如果找不到<branch>但在一个遥控器(称为<remote>)中确实存在一个匹配名称的跟踪分支,则视为等效于:

git checkout -b <branch> --track <remote>/<branch>