Git branching / rebasing good practices

Posted by Pawel Krupinski on Stack Overflow See other posts from Stack Overflow or by Pawel Krupinski
Published on 2010-04-08T17:13:30Z Indexed on 2010/04/08 17:23 UTC
Read the original article Hit count: 499

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about git

Related posts about dvcs