All of lore.kernel.org
 help / color / mirror / Atom feed
* How to merge from newer branch to older branches?
@ 2009-04-21 19:24 skillzero
  2009-04-21 19:36 ` Jeff King
  2009-04-22  4:46 ` John M. Dlugosz
  0 siblings, 2 replies; 9+ messages in thread
From: skillzero @ 2009-04-21 19:24 UTC (permalink / raw)
  To: git

I'm not sure how to merge a topic branch onto multiple branches
without conflicts or unwanted changes. My workflow probably isn't
ideal, but I often run into cases like this and wondered if there's a
way to solve it with git.

We have a "future" branch for new development. I wanted to add a new
feature so I branched from "future" to create a branch named
"feature". I completed the work, but now they've decided they need
that on two older branches. It looks like this:

future o-o-o-o-o-o-o
        \   \       \
1.2          o-o-o   \
          \           \
1.1        o-o-o       \
                        \
feature                  o-o-o
                         a b c

I've read I should have started from the oldest common denominator
branch that I might ever want, but at the time I created the branch,
"future" was it because we thought 1.1 and 1.2 were locked down and
not going to add new features. But things change and I need to roll my
feature into 1.1 and 1.2.

What's the best way to merge changes on the "feature" branch into the
1.1 and 1.2 branches? If I try to checkout 1.1 then 'git merge
feature', it (obviously) merges in a bunch of changes from "future"
that I don't want (and has a bunch of conflicts). I also tried just
cherry-picking commits a, b, and c from the "feature" branch. That
mostly worked, but there were some surprising conflicts. Text that had
been inserted into a couple files (which had been untouched in 1.1 and
1.2) caused a conflict when it seemed like it should have just added
the lines without conflict. I realize it's difficult to know why it
conflicted without seeing the changes, but I'm just asking in a more
general way how I should be doing merges like this.

Is cherry-picking the best way? It seems pretty tedious because I have
to do each commit in reverse order (although I could script it). I was
hoping there was a way to say "apply all the changes from when
"feature" branched up to its tip". I would also like to preserve the
commit history rather than just making making one big commit of all
the changes.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-04-22 21:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-21 19:24 How to merge from newer branch to older branches? skillzero
2009-04-21 19:36 ` Jeff King
2009-04-22  5:13   ` Junio C Hamano
2009-04-22 13:34     ` Jeff King
2009-04-22 17:44     ` skillzero
2009-04-22 20:15       ` Jeff King
2009-04-22 21:01         ` skillzero
2009-04-22 21:17           ` Jeff King
2009-04-22  4:46 ` John M. Dlugosz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.