All of lore.kernel.org
 help / color / mirror / Atom feed
From: bshOriginal <mindplayintricks@gmx.de>
To: git@vger.kernel.org
Subject: Git range merge (cherry-pick a range)
Date: Thu, 16 Jul 2009 01:11:23 -0700 (PDT)	[thread overview]
Message-ID: <24512201.post@talk.nabble.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0704201100050.4667@torch.nrlssc.navy.mil>


Playing around with GIT, we encountered the following strange situation for
which we would
like to have an answer:

Scenario
========

We want to merge the range B to D from branch B1 to master

Master:       o-
                  \
Branch B1:      A-B-C-D-E


Commit B:
---------
FluidSolver::FluidSolver(int argc, char* argv[]) {
    init(argc, argv);
    // test edit 1: a + b
}

Commit C:
--------
FluidSolver::FluidSolver(int argc, char* argv[]) {
    init(argc, argv);
    // test edit 1: a + b
    // test edit 2: a - b
}

Commit D:
--------
FluidSolver::FluidSolver(int argc, char* argv[]) {
    init(argc, argv);
    // test edit 1: a + b
    // test edit 2: a - b
    // test edit 3: a * b
}

Commit E:
--------
FluidSolver::FluidSolver(int argc, char* argv[]) {
    init(argc, argv);
    // test edit 1: a + b
    // test edit 2: a - b
    // test edit 3: a * b
    // test edit 4: a / b
}


Range merge (the GIT way):
=========================

1) Switch to Branch B1

2) Create a temporary branch which does not contain anything beyond commit D

   $ git checkout -b volatileBranch D

    Master:                 o-
                                \
    Branch B1:                A-B-C-D-E
                                                \
    Branch volatileBranch:              (A)-(B)-(C)-(D)

3) Rebase volatile branch to master from commit (B) to master's HEAD
   git rebase --onto master (A) 


    Branch volatileBranch:   (B)-(C)-(D)
                                     /
    Master:                      o-
                                     \
    Branch B1:                   A-B-C-D-E
                                       

Rebasing output:
----------------

First, rewinding head to replay your work on top of it...
Applying: test edit 2: a - b
error: patch failed: fluidsolver.cpp:28
error: fluidsolver.cpp: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging fluidsolver.cpp
CONFLICT (content): Merge conflict in fluidsolver.cpp
Failed to merge in the changes.
Patch failed at 0001 test edit 2: a - b


When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".


Conflicts:
----------
FluidSolver::FluidSolver(int argc, char* argv[]) {
    init(argc, argv);
<<<<<<< HEAD:fluidsolver.cpp
=======
    // test edit 1: a + b
    // test edit 2: a - b
>>>>>>> test edit 2: a - b:fluidsolver.cpp
}


After manually resolving the conflict and continuing the rebasing 
with git rebase --continue, we are finally finished.

Since we only had updates in branch 1, it is astonishing that we get a
conflict at all.
Same situation works like a charme in subversion.
We would be happy to get an explanation for this merge bahaviour, since 
many edits in large projects could as a matter of principle result a lot of
merge conflicts
which all have to be treated manually.

We believe that GIT's interface for range merges needs to get more user
friendly.
Since steps 1) - 3) use already developed components of GIT, there should be
a layer above 'em
which performs a range merge by internally calling 1) - 3).

Example: git cherry-pick $from_branch@startCommitHash
$to_branch@endCommitHash 



Greetings,

Babak Sayyid Hosseini






-- 
View this message in context: http://www.nabble.com/cherry-pick---since---tp10105685p24512201.html
Sent from the git mailing list archive at Nabble.com.

  parent reply	other threads:[~2009-07-16  8:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20 16:20 cherry-pick --since ? Brandon Casey
2007-04-20 18:55 ` Alex Riesen
2007-04-22 12:06   ` David Kågedal
2007-04-20 23:05 ` Junio C Hamano
2007-04-23 17:52   ` Brandon Casey
2007-04-23 19:32     ` Junio C Hamano
2007-04-23 23:18       ` Brandon Casey
2009-07-16  8:11 ` bshOriginal [this message]
2009-07-16 11:36   ` Git range merge (cherry-pick a range) Michael J Gruber
     [not found]     ` <6efe9a9b0907160516o75641919wd1eecf5229aea895@mail.gmail.com>
2009-07-16 12:44       ` Michael J Gruber
2009-07-16 16:27   ` Daniel Barkalow
2009-07-17  8:41   ` bshOriginal

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=24512201.post@talk.nabble.com \
    --to=mindplayintricks@gmx.de \
    --cc=git@vger.kernel.org \
    /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 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.