如何从远程分支“someBranch”拉到本地分支“sonOfSomeBranch”?

时间:2021-05-18 11:29:31

标签: git branch git-workflow

所以,我和我的队友有这些分支:mastersomeBranchsonOfSomeBranch。正如您可能已经猜到的那样,最后一个分支是 someBranch。我在本地和远程都对它们进行了跟踪。

我已将代码推送到我的 sonOfSomeBranch,但我的队友同时也在 someBranch 上做了一些工作。现在,我想将她所做的一切纳入我的 sonOfSomeBranch

可以这样做吗,如果可以,怎么做?我只是想从 someBranch 中提取她的代码并手动将其添加到 sonOfSomeBranch,但必须有一个更聪明的解决方案。

1 个答案:

答案 0 :(得分:1)

拉动 someBranch 并将其合并到 sonOfSomeBranch 中:

git checkout sonOfSomeBranch
git fetch origin someBranch:someBranch
git merge someBranch
git push origin sonOfSomeBranch

或者拉动 someBranch 并在其上重新设置 sonOfSomeBranch

git fetch origin someBranch:someBranch
git rebase someBranch sonOfSomeBranch
git push --force origin sonOfSomeBranch
相关问题