Created
October 1, 2012 15:59
-
-
Save jperkin/3812675 to your computer and use it in GitHub Desktop.
git branching plan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--A-------B-------C--D------------E------F--- origin/trunk | |
/ / / / | |
--------------------------------------------- upstream/trunk | |
\ \ | |
-- upstream/pkgsrc_2012Q2 -- upstream/pkgsrc_2012Q3 | |
- upstream/trunk is clean pkgsrc HEAD | |
- origin/trunk tracks upstream/trunk periodically, and adds Joyent-specific changes | |
- pkgsrc gets branched every quarter | |
We want to: | |
- Create quarterly release branches | |
- Apply changes A-E, preserving history | |
- Make it easy to cherry-pick F.. |
I can't figure out how to edit comments, but there are some slashes and backslashes with the wrong amount of space before them, and some spelling mistakes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Suppose you want a new branch called "newbranch" which is based on upstream/pkgsrc_2012q3, but also has changes A to E.
I'd probably stare by creating the new branch from commit E,
then rebase the new branch onto upstream/pkgsrc_2012Q3.
Commit E is 2 commits before the head of origin/trunk,
so if you don't have a tag there, you can add one:
$ git tag base-for-newbranch origin/trunk~2
Use gitk to check that the tag is in the right place.
Then checkout that tag and create the branch:
$ git checkout base-for-newbranch
$ git branch newbranch
Now the tree looks like this:
Now rebase newbranch ontp upstream/pkgsrc_2012Q3:
$ git rebase --onto upstream/pkgsrc_2012Q3 upstream/trunk newbranch
That means: take the changes that are in newbranch and are not in
upstream/trunk, and apply those changes to upstream/pkgsrc_2012Q3,
and call the result "newbranch".
So now you should have this:
where A' to E' contian essentially the same changes as A to E.