Pull remote branch into local repo with different name?

╄→尐↘猪︶ㄣ 提交于 2019-12-20 08:19:59

问题


Alright I did a little bit of research on this but I couldn't find an exact answer, so I have to ask.

I have 2 remotes: origin and repo2.

I'd like to do something like

git pull repo2 master

But this would pull the master branch of the repo2 into my master. Can I specify a different branch to pull into, for my local branch ?


回答1:


git checkout -b myBranchName repo2/master



回答2:


The git pull command is a convenience function that does git fetch and git merge. If you only want retrieve branches from a new remote without trying to merge it into any working copy branch you can just use git fetch. You can then refer to git branch -av to see all the local and remote branches and operate on either remote as you like.



来源:https://stackoverflow.com/questions/12043236/pull-remote-branch-into-local-repo-with-different-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!