Git 远程多分支git-fetch拉取到本地
远程代码仓库有分支
master
hotfix
release
develop
feature
初始化并且关联远程仓库获取master
分支
$ git pull origin master
查看本地仓库全部分支
liukeruideMacBook-Pro:ps liukerui$ git branch -a
* master
remotes/origin/master
如何在拉取远程hotfix
分支
如果继续使用git pull origin hotfix
会发现需要合并分支,因为git-pull = git-fetch + git-merge
。所以步骤如下:
$ git fetch origin hotfix
$ git checkout -b hotfix origin/hotfix
验证一下
liukeruideMacBook-Pro:ps liukerui$ git branch -a
* hotfix
master
remotes/origin/hotfix
remotes/origin/master