Git development
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: Mike Jarmy <mjarmy@gmail.com>
Cc: <git@vger.kernel.org>
Subject: Re: Commiting changes onto more than one branch
Date: Wed, 25 Nov 2009 17:47:55 +0100	[thread overview]
Message-ID: <200911251747.57456.trast@student.ethz.ch> (raw)
In-Reply-To: <6b4a562b0911250831q332ac3b5m6ee38f59e7a6f391@mail.gmail.com>

Mike Jarmy wrote:
> Suppose that I checkout the v3 branch, and fix the bug by editing
> several different files.  (Lets assume for now that the files in
> question have not diverged between any of the 3 branches, even though
> tons of other files have changed).  How do I commit the bugfix into
> all of v3, v4 and v5?  Clearly, merging the branches together would be
> bad.  So I think what I should do is perform 3 different commits, but
> I'm not quite sure how to juggle the git index (or stash or whatever)
> to accomplish this.  This may be a really obvious question, but I'm a
> confused git newbie.

You can build the fix on top of the merge-base of v3, v4 and v5, i.e.

  git checkout -b myfix $(git merge-base v3 $(git merge-base v4 v5))
  # work
  git commit

and then merge it to each of the version branches:

  for b in v3 v4 v5; do
    git checkout $b
    git merge myfix
  done

So much for the theory.  In the model suggested in the gitworkflows(7)
manpage and used in git.git, v3 is contained in v4 and similar for v5.
This means that after merging (possibly several) fixes to v3, you can
merge v3 into v4 and v4 into v5 (and so on, through all versions) to
propagate the fixes.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

  parent reply	other threads:[~2009-11-25 16:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25 16:31 Commiting changes onto more than one branch Mike Jarmy
2009-11-25 16:38 ` Eugene Sajine
2009-11-25 16:47   ` Mike Jarmy
2009-11-25 17:38     ` Avery Pennarun
2009-11-25 18:58     ` Junio C Hamano
2009-11-25 19:43       ` Mike Jarmy
2009-11-25 23:41         ` Daniel Barkalow
2009-11-25 23:56           ` Andreas Schwab
2009-11-25 16:47 ` Thomas Rast [this message]
2009-11-25 16:50 ` Jakub Narebski
2009-11-25 17:40   ` Mike Jarmy
2009-11-25 17:43 ` Nicolas Pitre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200911251747.57456.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=mjarmy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox