Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Implement cherry-pick by merge

On Tue, Sep 21, 2010 at 16:14, Shawn Pearce (Code Review)
<codereview-daemon@xxxxxxxxxxx> wrote:
> cherry-pick can be implemented using merge.  :-)
>
> Lets say we want to cherry-pick commit C, whose parent is B, and we want to apply it on top of Q:
>
>  o----- B ----- C
>   \
>    o--o--o-- Q
>
> * Set the "ours" side to be Q.
> * Set the "theirs" side to be C.
> * Fix the merge base to be C^1, that is B.
>
> Where there is a B-C difference, it shows up as an edit made by "them" and is applied by the merge as a "theirs" side edit.  Where there is a B-Q
> difference, it shows up as an edit made by "us" and shows up as an "ours" side edit.  Providing that these edits aren't conflicting, the merge will complete
> cleanly.

Great news. I thought the core of a cherry-pick would be some kind of
apply-patch. I was already planning some extra ours in finding out how
native git does cherry-pick. But seems to be that is not needed,
right? Or are there cases where we don't reuse merge for cherry-pick?

Ciao
  Chris


Back to the top