git/list[1] front-page[2] threads[3] people[4] search[5] about
 

cherry-pick applies some other changes than the specified one?

From
Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Date
Mar 21, 2011, 09:27 UTC
Message-ID
<AANLkTikE5AqJyShN+GfFYe0kBS=ShGnKQcnwbarNZrjm@mail.gmail.com>
Hi,

I'm cherry-picking one commint between branches. The commit is a simple one-line addition, something like:

--- a/etc/file
+++ b/etc/file
@@ -2613,6 +2613,7 @@
line1
line2
+   line3
line4
line5


There's a conflict during the cherry-pick. git status shows:

$ git status
# On branch 9_0
# Unmerged paths:
#   (use "git add/rm <file>..." as appropriate to mark resolution)
#
#	both modified:      etc/file
#
no changes added to commit (use "git add" and/or "git commit -a")

git diff shows a lot of changes:

diff --cc etc/file
index 815c28f,b8a48da..0000000
--- a/etc/file
+++ b/etc/file
@@@ -2700,83 -2611,10 +2700,89 @@@
[...]
++<<<<<<< HEAD
 +    line
 +    line
[...]
++=======
+     here I basically can see what's code
+     look like in the commit I want to merge
++>>>>>>> c64e8ca...
       line
 +    line
[...]


If I edit the file and remove the "<<<< HEAD" marked and code
between "===" and ">>>"  then

1. git status shows there are unmerged files:

$ git status
# On branch 9_0
# Unmerged paths:
#   (use "git add/rm <file>..." as appropriate to mark resolution)
#
#	both modified:      etc/file
#
no changes added to commit (use "git add" and/or "git commit -a")

2. git diff shows nothing:

$ git diff
diff --cc etc/file
index 815c28f,b8a48da..0000000
--- a/etc/file
+++ b/etc/file

3. git diff --cached shows error? warning? info?

$ git diff --cached
* Unmerged path etc/file

4. When I git add the file then git status, git diff, git diff
--cached shows nothing:

$ git add etc/file
$ git status
# On branch 9_0
nothing to commit (working directory clean)
$ git diff
$ git diff --cached


But when I take a different approach, and in addition to this:

> If I edit the file and remove the "<<<< HEAD" marked and code
> between "===" and ">>>"  then

I also manually add the "+line" which is the change done in the cherry-picked
commit, git diff shows a lot of other changes in unrelated lines
(which lie close
but still were not modified by the patch, nor were shown previously by
git diff).


This is very weird. I understand the information I provided was very scarce,
but does anyone know what could be happening?
Or do I have to try to reproduce this behaviour and post the steps to do so?

It might be somehow related to git-svn or git-new-workdir ...
-- 
Piotr Krukowiecki
Next: Junio C Hamano
Message 1 of 13 in “cherry-pick applies some other changes than the specified one?”
  1. Piotr KrukowieckiMar 21, 2011
  2. Junio C HamanoMar 21, 2011
  3. Johannes SixtMar 21, 2011
  4. Piotr KrukowieckiMar 21, 2011
  5. Junio C HamanoMar 21, 2011
  6. Piotr KrukowieckiMar 21, 2011
  7. Jonathan NiederMar 21, 2011
  8. Piotr KrukowieckiMar 21, 2011
  9. Junio C HamanoMar 21, 2011
  10. Junio C HamanoMar 21, 2011
  11. Jonathan NiederMar 22, 2011
  12. Junio C HamanoMar 22, 2011
  13. Piotr KrukowieckiMar 22, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.