git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to handle a git repository with multiple branches

From
David Ripton <dripton@ripton.net>
Date
Aug 26, 2010, 21:17 UTC
Message-ID
<4C76D9F6.7070306@ripton.net>
In-Reply-To
<AANLkTimW-SQi1eprxTPXxF85SBO4d5MU13=dsboNNrzd@mail.gmail.com>
On 08/26/10 07:53, Erez Zilber wrote:
Show 17 quoted lines
> Some commits are relevant only for branch_1, some are relevant only
> for branch_2 and some are relevant for both. For the commits that are
> relevant for both branches, I thought about the following solutions:
> 1. Put these common commits in branch_1 and merge branch_1 into
> branch_2. This is bad because it will also merge commits that are
> relevant only for branch_1.
> 2. Cherry-pick the common commits from branch_1 to branch_2. This is
> also bad because the commit ID changes, and in case of conflicts, git
> is unable to tell that these 2 commits are actually the same commit.
> This makes it very difficult to track the changes between branches.
>
> Since there are several other developers and sub-maintainers in this
> project which are rebased on both these branches, I don't want to
> change the git history of my branches because when I do that,
> sub-maintainers and developers lose the reference to their base.
>
> I'm looking for a better solution. Is there any best-practice solution?

Fix bugs in the oldest release branch to which the fix applies. Then merge the old branches into the new ones.

When this doesn't work, then you have to cherry pick.
-- 
David Ripton    dripton@ripton.net
Previous: Joshua JuranNext: Jon Seymour
Message 3 of 5 in “How to handle a git repository with multiple branches”
  1. Erez ZilberAug 26, 2010
  2. Joshua JuranAug 26, 2010
  3. David RiptonAug 26, 2010
  4. Jon SeymourAug 26, 2010
  5. Erez ZilberAug 31, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.