threads / discuss / 25699

Understanding git cherry-pick

Subject: Understanding git cherry-pick

## tl;dr

3 messages between Nov 10, 2010 and Nov 10, 2010.

replies: 2people: 2as markdown or json

Stephen Bash· Nov 10, 2010, 14:04 UTC · lore
Hi all-
In helping a coworker yesterday with a git cherry-pick operation, I found my mental model of cherry-pick seems to be flawed.  Our goal was to cherry-pick one commit from the current development branch back to the stable release branch (we're still training everyone on the *correct* way to do maintenance fixes).  Here's what happened:
$ git checkout release-branch
$ git cherry-pick 8815f3a0c2c248db223e41b0538f0c48b45fe52d
warning: too many files (created: 237 deleted: 2558), skipping inexact rename detection
Automatic cherry-pick failed.  After resolving the conflicts, mark the corrected paths with 'git add <paths>' or 'git rm <paths>' and commit the result with:
   git commit -c 8815f3a0c2c248db223e41b0538f0c48b45fe52d
git status reported the actual change we wanted from the commit applied cleanly; the conflicts were all added/deleted files between the two branches.  The commit only modifies a single file, and the file exists with the same name on both branches.
So what's actually going on here?  If the one changed file in the commit merged cleanly, why did the automatic cherry-pick fail?  Why does cherry-pick even care about file differences between the two branches that aren't modified by the commit in question?  Or is it user error?

Thanks, Stephen

Camille Moncelier· Nov 10, 2010, 19:43 UTC · re: Stephen Bash · lore

Re: Understanding git cherry-pick

On Wed, 10 Nov 2010 09:04:29 -0500 (EST) Stephen Bash <bash@genarts.com> wrote:

Show 10 quoted lines
> git status reported the actual change we wanted from the commit
> applied cleanly; the conflicts were all added/deleted files between
> the two branches.  The commit only modifies a single file, and the
> file exists with the same name on both branches.
> 
> So what's actually going on here?  If the one changed file in the
> commit merged cleanly, why did the automatic cherry-pick fail?  Why
> does cherry-pick even care about file differences between the two
> branches that aren't modified by the commit in question?  Or is it
> user error?

Which version are you using ? I had problem using anything < 1.7.3 when the cherry-pick happened between two branches where some files changed theirs types eg: a link become a file (But not the other way around)

See: http://thread.gmane.org/gmane.comp.version-control.git/160717/focus=160717

> 
> Thanks,
> Stephen

-- Camille Moncelier http://devlife.org

Stephen Bash· Nov 10, 2010, 20:01 UTC · re: Camille Moncelier · lore

Re: Understanding git cherry-pick

----- Original Message -----
Show 20 quoted lines
> From: "Camille Moncelier" <moncelier@devlife.org>
> To: "Stephen Bash" <bash@genarts.com>
> Sent: Wednesday, November 10, 2010 2:43:23 PM
> Subject: Re: Understanding git cherry-pick
>
> On Wed, 10 Nov 2010 09:04:29 -0500 (EST)
> Stephen Bash <bash@genarts.com> wrote:
> 
> > git status reported the actual change we wanted from the commit
> > applied cleanly; the conflicts were all added/deleted files between
> > the two branches. The commit only modifies a single file, and the
> > file exists with the same name on both branches.
> >
> > So what's actually going on here? If the one changed file in the
> > commit merged cleanly, why did the automatic cherry-pick fail? Why
> > does cherry-pick even care about file differences between the two
> > branches that aren't modified by the commit in question? Or is it
> > user error?
> 
> Which version are you using ?
1.7.3 on the machine I reproduced the issue on...  My coworker has something post-1.7.2 but I'm not exactly sure.

Thanks, Stephen

← back to recent threads