# Applying changes across divergent branches

2 messages from 2008-09-24 to 2008-09-24. Participants: Tom Schutzer-Weissmann, Jeff King.
Thread: https://gitlist.dev/t/15650

## Tom Schutzer-Weissmann, 2008-09-24 14:40

Subject: Applying changes across divergent branches
Message-ID: <48DA514E.6060904@siscog.pt>
URL: https://gitlist.dev/e/48DA514E.6060904%40siscog.pt

```
Hello all,

I am looking into how to apply git to some current working methods.

We tend to have two or three main branches: the development branch, and 
one or two product branches. The development branch is the cutting edge, 
and each product branches off from it.

While the product branch shares history with the development branch, not 
all changes to the development branch will get applied to the product 
branch. We tend to maintain two versions of a product at any time, 
meaning two divergent product branches.

Could we use git, or a tool based on git, to change on the development 
branch and selectively apply changes to the other branches - is it as 
simple as using git cherry-pick?

Thanks in advance,
Tom SW

```

## Jeff King, 2008-09-24 17:09

Subject: Re: Applying changes across divergent branches
Message-ID: <20080924170956.GA9265@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20080924170956.GA9265%40coredump.intra.peff.net
In-Reply-To: <48DA514E.6060904@siscog.pt>

```
On Wed, Sep 24, 2008 at 03:40:14PM +0100, Tom Schutzer-Weissmann wrote:

> Could we use git, or a tool based on git, to change on the development  
> branch and selectively apply changes to the other branches - is it as  
> simple as using git cherry-pick?

If I am understanding your description of the problem correctly, then
yes, it is as simple as cherry-picking.

If your branches have a strict hierarchy, you can also use a "merge up"
workflow where some branches always contain all of other branches. For
example, in git has a "maint" branch for stable bugfixes and a "master"
branch for general development. The rule is that one must always merge
"up", meaning that master can merge from maint, but maint can never
merge from master. Stable bugfixes go on maint, and then get to master
by merging.

Depending on the details of your branches, something like that may work
for you. You can have a "base" branch that all product branches merge
from, and only changes which should affect all products go on that
branch (or on topic branches that are based on the "base" branch).

-Peff

```
