跟踪在GitHub上创建的新远程分支 [英] Track a new remote branch created on GitHub

查看:117
本文介绍了跟踪在GitHub上创建的新远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有一个本地主分支跟踪github项目的远程主分支。现在,我的一位合作者在同一个项目中创建了一个新分支,并且我相应地执行以下操作:


  1. 创建一个新分支本地分支

  2. 使这个新分支跟踪新创建的远程分支。
  3. 解决方案

      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:

    1. create a new branch locally
    2. make this new branch track the newly create remote branch.

    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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆