Subject: Re: Merging a commit from a distant branch, cherry-pick seems to fail

From: Johannes Sixt <[email-masked]>
Date: Tue, 08 Jun 2010 07:57:28 +0200

Am 6/8/2010 0:46, schrieb Sjors Gielen:
> sjors@smbp:~/Projecten/kmess/git$ git log -1 --name-only --oneline f9380fd43a2c1
> f9380fd 2010-06-03 (Sjors) (noknotify branch)
> ChangeLog
> src/CMakeLists.txt
> src/notification/macnotification.cpp
> src/notification/macnotification.h
> src/notification/notificationmanager.cpp
> src/notification/notificationmanager.h
...
> sjors@smbp:~/Projecten/kmess/git$ git status
> # On branch kmess-2.0.x
> # Changes to be committed:
> #   (use "git reset HEAD <file>..." to unstage)
> #
> #	modified:   src/CMakeLists.txt
> #	new file:   src/notification/macnotification.cpp
> #	new file:   src/notification/macnotification.h
> #	modified:   src/notification/notificationmanager.cpp
> #
> # Unmerged paths:
> #   (use "git reset HEAD <file>..." to unstage)
> #   (use "git add/rm <file>..." as appropriate to mark resolution)
> #
> #	both modified:      ChangeLog
> #	added by us:        contrib/isf-qt
> #	both modified:      src/notification/notificationmanager.h
> #
...
> I'd have expected git cherry-pick to simply take the changes in commit
> f9380fd43 and apply them to kmess-2.0.x, without pulling along history
> in 'master'. Testing and debugging in the #git channel on Freenode didn't
> show what I was doing wrong (<http://git.pastebin.com/dUntbHDV>). Now I
> could just take the patch with 'git show' and use 'git apply' to apply it,
> but that doesn't seem like the Git way to do this. So the question is:
> does any of you know why this is happening, what I'm doing wrong, and what
> I should do instead?

You did nothing wrong. If at all, there is a bug in git.

The *only* curious thing after your cherry-pick is this:

> #	added by us:        contrib/isf-qt

because contrib/isf-qt is not touched by the commit that you are
cherry-picking.

contrib/isf-qt is a submodule on branch kmess-2.0.x, but it is a regular
directory on master. I don't think that git should report it as a conflict.

To go ahead, simply resolve the conflicts in ChangeLog and
notificationmanager.h, and make sure that you do not have staged any
changes to contrib/isf-qt before you commit.

-- Hannes