threads / discuss / 15650

Applying changes across divergent branches

Subject: Applying changes across divergent branches

## tl;dr

2 messages between Sep 24, 2008 and Sep 24, 2008.

replies: 1people: 2as markdown or json

Tom Schutzer-Weissmann· Sep 24, 2008, 14:40 UTC · lore
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· Sep 24, 2008, 17:09 UTC · re: Tom Schutzer-Weissmann · lore

Re: Applying changes across divergent branches

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

← back to recent threads