用git获取新的上游分支 [英] Get new upstream branch with git
问题描述
我分叉了一个回购协议,我所有的工作都进入了这个分支(我的出身),并且我将分支上游的分支合并到了请求中。漂亮的标准。
但是现在在上游repo中有一个新的分支,我不能完全弄清楚如何在本地获得新的分支,然后将其推到我的原点。这是我的情况。
$ git remote show origin
* remote origin
抓取网址:git @ github.com:rackspace/jclouds.git
推送URL:git@github.com:rackspace / jclouds.git
HEAD分支:master
远程分支:
1.5.x跟踪
master跟踪
为'git pull'配置的本地分支:
主人与远程主人合并
为'git push'配置的本地ref:
主人推送给主人最新)
$ git remote显示上游
*远程上游
提取网址:https://github.com/jclouds/jclouds
推送网址:https ://github.com/jclouds/jclouds
HEAD分支:master
远程分支:
跟踪的主数
为'git push'配置的本地参考:
主推掌握(最新)
我知道jclouds / jclouds中有一个1.6.x分支我想在本地获得该分支,然后推送它到rackspace / jclouds。我试过这个命令
$ git fetch upstream 1.6.x
从https://github.com/ jclouds / jclouds
*分支1.6.x - > FETCH_HEAD
它看起来像是取得了分支,但我没有在<$ c $中看到它c> git remote show 或 git branch -a
所以我无法设置本地跟踪分支。
我缺少什么?
这应该够了
#我喜欢从上游获取所有内容
git fetch upstream
#然后我使用本地分支追踪新的远程分支
git checkout -b 1.6.x --track upstream / 1.6.x
git push origin 1.6.x
如果有更新问题,如:
致命:无法更新路径并切换到分支1.6。 x'在同一时间。
您是否打算将无法解析为提交的'upstream / 1.6.x'结帐?
如果这不起作用:
git checkout upstream / 1.6.x -b 1.6.x
然后更简单的版本是:
<$ p $我们先创建一个新的本地分支
git checkout -b 1.6.x
#然后重置它的起点
git reset --hard upstream / 1.6。 x
什么 Everett Toews 必须做的事情是:
最终,我必须明确地添加上游分支
git remote add --track 1.6.x upstream-1.6.x https://github.com/jclouds/jclouds
然后:
git pull upstream-1.6.x 1.6.x
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 branch in the upstream repo and I can't quite figure out how to get that new branch locally and then push it to my origin. Here is my situation.
$ git remote show origin
* remote origin
Fetch URL: git@github.com:rackspace/jclouds.git
Push URL: git@github.com:rackspace/jclouds.git
HEAD branch: master
Remote branches:
1.5.x tracked
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
$ git remote show upstream
* remote upstream
Fetch URL: https://github.com/jclouds/jclouds
Push URL: https://github.com/jclouds/jclouds
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (up to date)
I know that there is a 1.6.x branch in jclouds/jclouds and I want to get that branch locally and then push it to rackspace/jclouds. I've tried this command
$ git fetch upstream 1.6.x
From https://github.com/jclouds/jclouds
* branch 1.6.x -> FETCH_HEAD
And it looks like it's fetched the branch but I don't see it in git remote show
or git branch -a
so I'm unable to setup a local tracking branch.
What am I missing?
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
这篇关于用git获取新的上游分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!