[英]Git - Move feature branch ancestor pointer to latest commit on Master
I'm following a workflow similar to the one describe by Scott Chacon in his Pro Git book and illustrated in 3.2 Git Branching . 我正在遵循与Scott Chacon在其Pro Git书中描述的工作流程类似的工作流程,并在3.2 Git Branching中进行了说明 。
I have created a branch (following along from Scott's example) iss53
. 我创建了一个分支(遵循Scott的示例)
iss53
。 I've done work on that branch, but then need to switch gears and tackle a new issue. 我已经完成了该分支的工作,但是随后需要切换齿轮并解决新问题。 I create branch
hotfix
. 我创建分支
hotfix
。 Commits are added to hotfix
and then merged back into master
: 提交添加到
hotfix
,然后合并回master
:
In Scott's example he doesn't need to take the commit from hotfix
(C4) and apply it to iss53
, but say I do. 在Scott的示例中,他不需要从
hotfix
(C4)中获取提交并将其应用于iss53
,但是说我愿意。
How can I update my feature branch so that it appears to have been branched from a later commit? 如何更新功能分支,使其似乎已从以后的提交分支了?
Effectively, I want to update iss53
so that it looks like this: 实际上,我想更新
iss53
,使其看起来像这样:
Update: 更新:
After researching this further, this article was what I was looking for to explain merging vs rebaseing: http://blog.sourcetreeapp.com/2012/08/21/merge-or-rebase/ 在对此进行了进一步研究之后,本文正是我想要解释合并与重新建立基础的内容: http : //blog.sourcetreeapp.com/2012/08/21/merge-or-rebase/
Use rebase which is explained after few pages in the same book. 使用rebase ,这在同一本书的几页之后进行了介绍。
$ git checkout iss53
$ git rebase master
Note that, rebase should be avoided if branch iss53 is pushed to a remote that other people can access . 请注意,如果将分支iss53 推送到其他人可以访问的远程位置,则应避免重新设置基准。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.