Git:从上游转入开发分支 [英] Git: rebase onto development branch from upstream
问题描述
我有本地的 master
和 develop
分支。我将所有工作都放在 develop
上,然后将它们合并到版本的 master
中。有一个远程分支 upstream / master
,它有我想要的更改,但我想重新设置 develop中的更改
(它共享一个共同的祖先),并将它们放回到 develop
中。我已经完成 git fetch upstream
。
Git书籍关于重定义的章节说要做的事:
$ git checkout experiment
$ git rebase master
其中我假设)在我的情况下将意味着:
$ $ p $ $ code $ git checkout upstream / master
$ git rebase develop
但是我会在 upsteam / master
和在分离头部状态。但是,如果我做了 upstream / master
的合并,我会从 develop
这样做,在$ 开发
,例如$ git merge upstream / master
所以这种重新分配方式似乎落后于我。我想在 希望这是有道理的,有人可以帮助我,这将是感激。 rebase实际上是: ( 最终的结果不会是分离的头部,但是新重写的 I have local The Git book chapter on rebasing says to do: Which I (assume) in my case would mean: But then I'd be on the So this way to rebase seems backward to me. I'd like to rebase my changes in Hopefully this makes sense and someone can help me with this, it would be gratefully appreciated. The rebase would actually be: ( And the end result wouldn't be a detached head, but the newly rewritten 这篇关于Git:从上游转入开发分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!开发
分支中改变开发
中的更改,其中上游/主
类似于合并的工作方式。我应该在 upstream / master
上进行rebase,修正所有冲突,然后添加它,将其保存并将其弹出到 develop $
git checkout develop
git rebase upstream / master
git rebase
应阅读:重新分配我目前的分支,这里开发
,在目标分支之上,这里 upstream / master
)
开发
分支。master
and develop
branches. I do all my work on develop
and then merge them into master
for releases. There is a remote branch, upstream/master
which has changes I want, but I want to rebase my changes in develop
(which shares a common ancester) on top of its changes and put them back into develop
. I've already done git fetch upstream
.$ git checkout experiment
$ git rebase master
$ git checkout upstream/master
$ git rebase develop
upsteam/master
and in detached head state. However, if I did a merge of upstream/master
, I'd do that from develop
, and the changes would be on develop
, e.g.$ git checkout develop
$ git merge upstream/master
develop
on the develop
branch with the changes from upstream/master
similar to how the merge would work. Am I supposed to do the rebase on upstream/master
, fix any conflicts, and then add it, stash it and pop it onto develop
?git checkout develop
git rebase upstream/master
git rebase
should read: "rebase my current branch, here develop
, on top of target branch, here upstream/master
")develop
branch.