Get new upstream branch with git

最后都变了- 提交于 2019-11-30 06:50:11
VonC

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