例如,我正在处理feature分支,另一个开发人员现在正在创建/开发他的最新补丁,而我必须在我的feature分支中使用(添加)他的补丁。
我该怎么做呢?
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,它不是很好,对吧?
用新信息更新(刷新)工作分支的正确方式是什么?
发布于 2013-04-01 20:32:08
这似乎是错误的:git rebase my-feature-branch develop
它应该是:
git rebase develop my-feature-branch`您需要做的是在现在更新的develop分支上重新设置您在my-feature-branch中已经完成的操作的基础。
不需要在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发布于 2013-04-01 18:53:44
找到修补程序的提交,然后对其执行cherry-pick操作。
https://stackoverflow.com/questions/15742060
复制相似问题