threads / discuss / 33881

Workflow Help

Subject: Workflow Help

## tl;dr

4 messages between May 21, 2013 and May 21, 2013.

replies: 3people: 4as markdown or json

Quilkey, Tony· May 21, 2013, 00:59 UTC · lore
Hi,

I am looking at formulating and then documenting our vcs workflow using Git at work. I have an idea of how I want things to work, but am a little hazy on some of the details.

Our basic workflow will be based around: http://nvie.com/posts/a-successful-git-branching-model, with a few exceptions.

We would like to create our release-* branches from the last release tag. From there, we would like the ability to cherry pick (or take the complete diff) commits from the develop branch.

So, we are after is:
1) Create topic (feature) branches from develop, and merge back into
develop when complete.
2) Once it is decided we are packaging a release, make a release-*
branch from the previous release tag.
3) Cherry pick/merge/whatever any commits we want from develop into
the new release-* until it is complete.
4) Merge the new release-* branch into master and tag it.
Repeat as necessary.

At the moment I am a little stuck on how exactly we can cherry pick stuff from develop into a release-* branch. I'm not even sure this approach is exactly what we should be doing.

Our main concern is that at this stage, there is no guarantee that all commits within develop can be pulled into a release.

In regards to how we can achieve the above results any input would be much appreciated. Or if there are any other better options available, I'm all ears.

Thanks,
Tony Quilkey
John Keeping· May 21, 2013, 09:23 UTC · re: Quilkey, Tony · lore

Re: Workflow Help

On Tue, May 21, 2013 at 10:59:17AM +1000, Quilkey, Tony wrote:
Show 30 quoted lines
> I am looking at formulating and then documenting our vcs workflow
> using Git at work. I have an idea of how I want things to work, but am
> a little hazy on some of the details.
> 
> Our basic workflow will be based around:
> http://nvie.com/posts/a-successful-git-branching-model, with a few
> exceptions.
> 
> We would like to create our release-* branches from the last release
> tag. From there, we would like the ability to cherry pick (or take the
> complete diff) commits from the develop branch.
>
> So, we are after is:
> 
> 1) Create topic (feature) branches from develop, and merge back into
> develop when complete.
> 
> 2) Once it is decided we are packaging a release, make a release-*
> branch from the previous release tag.
> 
> 3) Cherry pick/merge/whatever any commits we want from develop into
> the new release-* until it is complete.
> 
> 4) Merge the new release-* branch into master and tag it.
> 
> Repeat as necessary.
> 
> At the moment I am a little stuck on how exactly we can cherry pick
> stuff from develop into a release-* branch. I'm not even sure this
> approach is exactly what we should be doing.

Having been involved in a couple of projects that use cherry-pick like this, I strongly advise against doing this. It makes it much harder than it needs to be to find out which branches contain a particular commit.

The workflow described in the URL above does the more sensible thing of periodically merging the release branch(es) back into master (or develop). This is similar to the workflow Junio uses to develop Git itself, which is described in gitworkflows(7).

The idea is to start your topic branch from the oldest release to which a bugfix must be applied, then merge it into the appropriate release branches. Then you merge this branch upwards into the later release branches and your development branch. So your development branch always contains all release branches (not just similar commits, but the *same* commits so that each release branch tip is an ancestor of the development branch's tip).

This means that you can use "git branch --contains" or "git describe --contains" to answer the question "which release(s) contain this commit?", whereas with cherry picking there is no easy and reliable way to do so.

> Our main concern is that at this stage, there is no guarantee that all
> commits within develop can be pulled into a release.

One advantage of starting a bugfix topic branch from the oldest release it applies to is that you are developing and testing that fix on the release code. If it doesn't apply cleanly to the development branch then you fix the conflict when merging.

Of course you may start a bugfix branch from the wrong place, in which case you would have to cherry pick the commits back to an older branch, but this should be a rare occurrence and will sort itself out as you merge the fix upwards.

> In regards to how we can achieve the above results any input would be
> much appreciated. Or if there are any other better options available,
> I'm all ears.
Magnus Bäck· May 21, 2013, 13:07 UTC · re: Quilkey, Tony · lore

Re: Workflow Help

On Monday, May 20, 2013 at 20:59 EDT,
     "Quilkey, Tony" <trq@thorpesystems.com> wrote:
Show 11 quoted lines
> I am looking at formulating and then documenting our vcs workflow
> using Git at work. I have an idea of how I want things to work, but am
> a little hazy on some of the details.
> 
> Our basic workflow will be based around:
> http://nvie.com/posts/a-successful-git-branching-model, with a few
> exceptions.
> 
> We would like to create our release-* branches from the last release
> tag. From there, we would like the ability to cherry pick (or take the
> complete diff) commits from the develop branch.

It would probably be easier to comment on your proposal if you motivated why you want to diverge.

Show 10 quoted lines
> So, we are after is:
> 
> 1) Create topic (feature) branches from develop, and merge back into
> develop when complete.
> 
> 2) Once it is decided we are packaging a release, make a release-*
> branch from the previous release tag.
> 
> 3) Cherry pick/merge/whatever any commits we want from develop into
> the new release-* until it is complete.

The point of having a release branch is typically to slow down the development pace and reduce risk by only adding changes that you really need. By starting the branch for release N+1 from the branch for release N it seems you have three ways forward:

   - Cherrypick a small number of commits from develop. That'll give you
     release N+0.1 rather than N+1.
   - Cherrypick many (if not most) commits from develop. That might give
     you a real release, but with a lot of work. Who should select which
     commits to cherrypick? How do you keep track of dependencies? Why
     would you want to move from a known state (develop, where people
     spend most of their time) to an unknown state?
   - Merge from develop to the release branch. What's the benefit
     compared to cutting the release branch directly from develop?

As another poster has pointed out, with merging instead of cherrypicking the standard Git tools will be able to do a better job at helping you track which corrections are made where.

[...]
-- 
Magnus Bäck
baeck@google.com
Andreas Ericsson· May 21, 2013, 13:49 UTC · re: Quilkey, Tony · lore

Re: Workflow Help

On 2013-05-21 02:59, Quilkey, Tony wrote:
Show 25 quoted lines
> Hi,
>
> I am looking at formulating and then documenting our vcs workflow
> using Git at work. I have an idea of how I want things to work, but am
> a little hazy on some of the details.
>
> Our basic workflow will be based around:
> http://nvie.com/posts/a-successful-git-branching-model, with a few
> exceptions.
>
> We would like to create our release-* branches from the last release
> tag. From there, we would like the ability to cherry pick (or take the
> complete diff) commits from the develop branch.
>
> So, we are after is:
>
> 1) Create topic (feature) branches from develop, and merge back into
> develop when complete.
>
> 2) Once it is decided we are packaging a release, make a release-*
> branch from the previous release tag.
>
> 3) Cherry pick/merge/whatever any commits we want from develop into
> the new release-* until it is complete.
>

This will drive you crazy. If you have any sort of tempo on development and separate your commits into small series, it will be close to impossible to track all related changes. I know, as some colleagues tried it not long ago.

A better workflow is to use topic-branches for pretty much everything. If the branch is mainly a bugfix, although the bug has to be fixed by refactoring or remodeling something, it gets merged to whatever "maint" branch you have (in your case I'd imagine that would be "release-X" something). Then you merge the release-branch into develop and take the other topics directly into develop.

We do something like this:
* work, work, work (mostly on master)
* cut a release by setting a tag and creating a maint-branch for it
   (actually, it's a beta-release that goes off to QA, but whatever)
* maint branches are 100% test-driven development
* bugfixes (with their test-cases, as well as test-cases for other
   affected areas) go directly to maint (although possibly via a
   topic-branch if the change is bigger than trivial).
* maint is merged to master
* repeat as necessary

It works reasonably well and ensures a high code quality with very little overhead. Sometimes people commit bugfixes to master by mistake. In that case, we simply cherry-pick the fix to 'maint' and then merge maint back to master as usual.

It does require some sort of stability between projects and the libs shipped by and used by the project though, but assuming you haven't done things horribly wrong at the design stage, this model should work reasonably well while avoiding the whole "where are the bugfixes and in which order do I need to apply them?" issue.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

← back to recent threads