问题描述
我有以下情况:
3个分支:
- 主数据
- MyBranch分支为Master开发系统新功能的目的
- MyBranchLocal分支MyBranch作为我的本地分支副本
MyBranch正在重新发布并推送到其他开发人员(他们正在开发与我相同的功能)。
作为MyBranch分支的所有者,我希望通过分期保持与Master同步。我还需要将我对MyBranchLocal所做的更改与MyBranch合并。
有什么方法可以做到这一点?
I。
1.将更改提交给MyBranchLocal
2 。将MyBranch对抗Master
3.将MyBranchLocal对MyBranch
进行重新分配4.将MyBranch与MyBranchLocal合并
II。 >
1.提交更改为MyBranchLocal
2.合并MyBranch与MyBranchLocal
3.重新分配MyBranch与Master
4.重新分配MyBranchLocal与MyBranch
三,
1.提交更改为MyBranchLocal
2.将MyBranch兑换为Master
3.将MyBranch与MyBranchLocal合并为
4.将MyBranchLocal与MyBranch重新绑定
我已经知道情景III似乎将提交历史搞乱了很多,可能会重复提交。
您有什么经验?你推荐什么样的方案来最大限度地减少合并工作并保持历史清洁? 我个人的建议。这个主要关注的是提交直接提交历史记录,并且在更具体的分支上失败(你最好搞乱你的本地分支而不是功能分支)。
$ b
- 对MyBranchLocal提交更改
- 将MyBranchLocal对MyBranch重新分配
- 将MyBranch与MyBranchLocal合并(应该是快进) - MyBranch =本地
- 可选)使用MyBranch合并Master(也应该快进)
- 根据MyBranch重新分配MyBranchLocal
- Commit change to MyBranchLocal
- Rebase MyBranchLocal against MyBranch
- Merge MyBranch with MyBranchLocal (should be fast forward) - MyBranch = Local
- Rebase MyBranch against Master
- (optional) Merge Master with MyBranch (also should be fast forward)
- Rebase MyBranchLocal against MyBranch
ol>
I have a following scenario:
3 branches:
- Master
- MyBranch branched off Master for the purpose of developing a new feature of the system
- MyBranchLocal branched off MyBranch as my local copy of the branch
MyBranch is being rebased against and pushed to by other developers (who are working on the same feature as I am).
As the owner of the MyBranch branch I want to keep it in sync with Master by rebasing. I also need to merge the changes I make to MyBranchLocal with MyBranch.
What is a good way to do that?
Couple of possible scenarios I tried so far:
I.
1. Commit change to MyBranchLocal
2. Rebase MyBranch against Master
3. Rebase MyBranchLocal against MyBranch
4. Merge MyBranch with MyBranchLocal
II.
1. Commit change to MyBranchLocal
2. Merge MyBranch with MyBranchLocal
3. Rebase MyBranch against Master
4. Rebase MyBranchLocal against MyBranch
III.
1. Commit change to MyBranchLocal
2. Rebase MyBranch against Master
3. Merge MyBranch with MyBranchLocal
4. Rebase MyBranchLocal against MyBranch
I already know that scenario III seems to be messing the commit history up a lot, potentially duplicating commits.
What is your experience? What scenarios do you recommend to minimize the merging effort and keep the history clean?
My personal suggestion. This one is focused on having a straight commit history, and failing on the "more specific" branches (you'd better mess up your local branch than the feature branch).
这篇关于Git分支/重新设计良好实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!