1

例如,我正在处理功能分支,另一位开发人员刚刚推动起源/开发他的最新修复,我必须在我的功能分支中使用(添加)他的修复。

我应该怎么做?

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为公共分支(开发)做,这不好,对吧?

用新信息更新(刷新)工作分支的正确方法是什么?

4

2 回答 2

0

找到修补程序的提交,然后找到cherry-pick它/它们。

于 2013-04-01T10:53:44.070 回答
0

这似乎是错误的:git rebase my-feature-branch develop

它应该是:

git rebase develop my-feature-branch`

您需要做的是在现在更新的分支my-feature-branch之上重新调整您已经完成的工作。 无需在.develop
mergemy-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 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-01T12:32:07.973 回答