It’s important to note that when you do a fetch that brings down new remote-tracking branches, you don’t automatically have local, editable copies of them. In other words, in this case, you don’t have a new
serverfix
branch — you have only anorigin/serverfix
pointer that you can’t modify
-
推送本地分支到远程(远程没有该分支)
git push <remote> <branch>
例如将本地
serverfix
分支推送到远程,这样远程仓库也有serverfix
分支了:git push origin serverfix
-
本地拉取远程分支(本地没有该分支):两步走-先拉取再checkout
$ git fetch origin $ git checkout -b serverfix origin/serverfix
拉取远程
serverfix
分支到本地的serverfix
分支 -
将本地已有分支与远程已有分支建立track关系
如下在本地
serverfix
分支敲这个命令:将当前分支 与 远程仓库的serverfix
分支建立track关系