我环顾四周,但没有看到这个确切问题的答案,所以我开始了:
git checkout master
git checkout -b release1
git checkout -b feature1
git checkout -b feature2
我在 feature1
上工作,其他人在 feature2
上工作,两者都被推送到原点
git checkout -b feature1
git pull
git checkout -b feature2
git pull
问题 1:我能否将 feature1
和 feature2
的最新版本 pull 到它们各自的本地分支,而不必单独检查它们并将它们分别 pull 出?
继续。 . .
git checkout release1
git merge feature1
git merge feature2
确实有人在处理 feature2
。
问题 2:我想将 origin 上的最新 feature2
merge 到我当前的 release1
分支中,而不是切换分支来 pull 它,然后再次切换以 merge 它。这可能吗?
最佳答案
没有办法(除了极端的 git hacking), merge 另一个分支的提交,无论是远程(git pull
)还是本地(git merge
),暗示 checkout “目标”分支。
关于git pull 到 branch_1 并同时 merge 到当前分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10182303/