Get new upstream branch with git

前端 未结 1 1849
执笔经年
执笔经年 2020-12-29 06:49

I\'ve forked a repo and all of my work goes into that fork (my origin) and I merge branches upstream with pull requests. Pretty standard.

But now there\'s a new bran

1条回答
  •  天涯浪人
    2020-12-29 07:23

    This should be enough

    # I prefer fetching everything from upstream
    git fetch upstream
    
    # Then I track the new remote branch with a local branch
    git checkout -b 1.6.x --track upstream/1.6.x
    git push origin 1.6.x
    

    If there are update issues like:

    fatal: Cannot update paths and switch to branch '1.6.x' at the same time. 
    Did you intend to checkout 'upstream/1.6.x' which can not be resolved as commit?"
    

    And if this doesn't work either:

    git checkout upstream/1.6.x -b 1.6.x
    

    Then a simpler version is:

    # let's create a new local branch first
    git checkout -b 1.6.x
    # then reset its starting point
    git reset --hard upstream/1.6.x
    

    What the OP Everett Toews has to do in his case was:

    Ultimately I had to explicitly add the upstream branch with

    git remote add --track 1.6.x upstream-1.6.x https://github.com/jclouds/jclouds 
    

    and then:

    git pull upstream-1.6.x 1.6.x
    

    0 讨论(0)
提交回复
热议问题