Wow, this is impressive - you spent some time compiling this :)
Thanks for typing it all up.
Tim
On 07/01/2011 09:31 AM, Kamil Paral wrote:
I've searched the web for best practices around software release
process with Git. It seems that the practices vary a lot. One of the
best articles I have come across is this one (I had to Flattr that
post):
http://nvie.com/posts/a-successful-git-branching-model/
Wow, that's a lot of detail. Nice find.
The process there is quite complex and sophisticated. I imagine it
is
required and very beneficial for large-scale projects. In our case
(just several developers) I believe we are better off with much
simpler process. But it's still a great source of inspiration.
In the release process there are some artifacts we recently talked
about and which could be important for us:
== A single stable branch ==
This is the branch containing only stable (production-ready) code. In
AutoQA we call in "stable". In the aforementioned article they call
it "master". There's a small difference in the process of adding
hotfixes. We used the same branch for pushing hotfixes and then
tagged a new hotfix release at some point. They have a separate
"hotfix" branch for those purposes and merge in once they want to
create a hotfix release. But otherwise it's the same.
The benefits of having such a branch: * People following this branch
don't have to track release announcements or periodically list
available tags. Simple "git pull" will always give them latest stable
code.
How many people are following AutoQA stable right now with their own
installations? If people are following the stable branch, I imagine that
they would prefer to decide when to upgrade on their own instead of
whenever we update stable but I could be wrong on that one.
The drawbacks of having such a branch: * It is not trivial to
maintain this branch with full commit history. My simple approach for
AutoQA 0.5.0 was to create a patch from stable to v0.5.0 and apply it
on stable [1]. But that does not keep history. The history is
retained if you run "git log v0.5.0", but not if you run "git log
stable". Tim tried to fix that problem by merging v0.5.0 and stable
[2]. But that has its own drawbacks. You need to solve merge
conflicts by hand and even if you do that, it is still possible that
stable differs from v0.5.0 (some code changes didn't need to be
detected as conflicts). With Tim's approach you still need to diff
your branches afterwards and resolve any remaining differences by my
diff-n-patch approach. It looks better in the end, but it also
requires more work. Interestingly the guy in that article didn't
mention this problem at all (although they must have encountered this
problem too).
I think that it's less of a problem with the vim plugin I found but
there may be other approaches, too. Either way, you're right that there
is a potential for conflicts and mistakes - probably not the ideal thing
to do.
All in all, stable branch has its uses and its challenges. We
don't
even need it, there are other approaches (described below). It's just
a matter what we desire. Do you think there are people out there
following just our stable branch? Do we care if they have to switch
tags from time to time?
I wonder if the question might be better phrased as: are there people
out there who want the AutoQA releases and don't just take the rpms from
the autoqa fedorapeople repo?
If someone is frustrated about having to switch tags/branches, I imagine
that they would also be frustrated about having to build their own RPM
or install AutoQA on all involved machines.
== Release branches ==
The principle is simple. With each tagged (minor) release we fork off
a separate branch out of it. For example for 0.5.0 release we create
"0.5-stable" branch. For 0.6.0 release we create "0.6-stable"
branch.
The rest of the process is the same as we have used till now. All
hotfix commits are pushed to the relevant release branch and then
tagged in some point of time. It then looks like this:
This sounds a lot cleaner and easier to me. +1
== Branches used for tagging ==
There was a discussion lately on which branch we should tag our
releases. I would like to clarify that. Due to the Git's nature this
question does not really apply. In the above text I already described
that branches and tags are almost the same -- pointers. The branch
determines just the top commit and all other commits are linked
through ancestor relationship. So you can't say "this commit is on
branch X", you can just say "this commit is accessible from branches
X, Y and Z". There is no ownership relationship. That means it
doesn't really matter which branch the particular commit used to
belong, it only matters if that is the top of the tree we want to
archive by tagging. The important questions are then: * Does it
contain the code we want? * Does it refer the commit tree log we
want?
I guess that I'd vote for tagging after branching here. My rationale for
that is that the versions would look the same after the X.0 release. I
do think that the later X.Y releases should be tagged on their
respective branch, though.
--o--o--o--o--o--o--o-- (master)
\ \ <cherry pick>
o--------------o--- (0.5 branch)
^ ^
tag:0.5.0 tag:0.5.1
Then again, I don't have any really strong opinions on this so I could
go either way on it. A ref is a ref is a ref. Like you said, the
important thing is that we get the code we're looking for and hopefully
the right commit log, too.
== Conclusion ==
I have described the current approaches. I may have misunderstood
something, I'll welcome corrections.
As for our project, I'm open to any suggestions. I think that our
current practice serves us well. I'm fine with the big-patch approach
for stable branch, because the commit history is retained for master
branch and for all the tags. I'm fine with Tim's merging approach
too.
OTOH I'm also fine with switching to using release branches. They are
pretty. And it may be simpler for understanding that our current
approach.
I think this is cleaner and easier than merging but still preserves the
commit history. This gets my vote going forward.
I don't think it would be viable for us to do both, release
branches
and stable branch. KISS.
So you're saying that I should hold off on a proposal for emailing all
patches and requiring sign-off by 2 other people before pushing to master?
BTW, I'm not serious about that proposal.