跟踪在GitHub上创建的新远程分支 [英] Track a new remote branch created on GitHub
问题描述
我已经有一个本地主分支跟踪github项目的远程主分支。现在,我的一位合作者在同一个项目中创建了一个新分支,并且我相应地执行以下操作:
- 创建一个新分支本地分支
- 使这个新分支跟踪新创建的远程分支。
- create a new branch locally
- make this new branch track the newly create remote branch.
git fetch
git branch --track branch -name origin / branch-name
第一个命令确保您在本地存储库中有远程分支。第二个命令创建跟踪远程分支的本地分支。它假定您的远程名称是 origin
,分支名称是 branch-name
。
- track
选项默认为远程分支启用,您可以忽略它。
I have already got a local master branch tracking the remote master branch of a github project. Now, a collaborator of mine has created a new branch in the same project, and I want to do the following accordingly:
How should I do it properly?
git fetch
git branch --track branch-name origin/branch-name
First command makes sure you have remote branch in local repository. Second command creates local branch which tracks remote branch. It assumes that your remote name is origin
and branch name is branch-name
.
--track
option is enabled by default for remote branches and you can omit it.
这篇关于跟踪在GitHub上创建的新远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!