Git 如何使用新内容更新我的功能/发布/修补程序/支持分支?
例如,我正在处理feature branch,另一个开发人员刚刚推出了他的最新补丁,我必须在我的feature branch中使用(添加)他的补丁 我该怎么做Git 如何使用新内容更新我的功能/发布/修补程序/支持分支?,git,Git,例如,我正在处理feature branch,另一个开发人员刚刚推出了他的最新补丁,我必须在我的feature branch中使用(添加)他的补丁 我该怎么做 git checkout -b my-feature-branch ... dealing with my issue ... ... alarm! another developer just released his fix, I need it here in my feature branch ... git stash git
git checkout -b my-feature-branch
... dealing with my issue ...
... alarm! another developer just released his fix, I need it here in my feature branch ...
git stash
git checkout develop
git pull origin develop
git rebase my-feature-branch develop
git checkout my-feature-branch
git merge develop
git stash apply
... dealing with my issue ...
git commit
git checkout develop
git merge my-feature-develop
git push origin develop
这是正确的行为吗
在这种情况下,很难弄清楚我的分支从哪里开始,从哪里结束。
第二点,我为公共部门(开发)做了rebase
,这不好,对吧
用新信息更新(刷新)工作分支的正确方法是什么?找到热修复程序的提交,然后提交它们。这似乎是错误的:
git-rebase-my-feature-branch-develope
应该是:
git rebase develop my-feature-branch`
您需要做的是在现在更新的develope
分支的基础上,重新设置您在myfeature分支中已经完成的工作。
无需在my feature branch
中进行merge
开发
完整的序列看起来像
git checkout -b my-feature-branch
... dealing with my issue ...
... alarm! another developer just released his fix, I need it here in my feature branch ...
git stash
git checkout develop
git pull origin develop
# remember that such a rebase will starts with a
# git checkout my-feature-branch
git rebase develop my-feature-branch
git stash apply
... dealing with my issue ...
git commit
git checkout develop
git merge my-feature-develop
git push origin develop
你能澄清这两行吗请记住,这样的重新基础将从一个#git checkout my特性开始-branch@user1016265from:git-rebase[][]
:如果指定了
,git-rebase
将在执行任何其他操作之前执行自动git签出。否则它将保留在当前分支上。在您的情况下,在develope
之上重新设置基础后,无需签出my feature branch
:重新基础将首先签出my feature branch
,因此在重新基础结束时,您当前的分支将是my feature branch
。感谢您的解释。如果我按照开头描述的那样做了,我应该修复一些东西吗?或者一切都会好起来?@user1016265在重新基础之前,开始是好的:你不应该在my feature branch
之上重新基础开发。您已经这样做了吗?@user1016265然后您可以使用reflog:,强制开发分支返回到它所在的位置,然后使用正确的重基继续。