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

Re: cherry picking and merge

From
MSMike Stump <mikestump@comcast.net>
Date
Aug 6, 2014, 18:41 UTC
Message-ID
<B8B80DE2-EC29-48FE-862F-D7A68DE6B243@comcast.net>
In-Reply-To
<53E24D07.9010105@gmail.com>
On Aug 6, 2014, at 8:43 AM, Jakub Narębski <jnareb@gmail.com> wrote:
Show 5 quoted lines
>>> I gave a solution for git using branches and it works just fine.  It
>>> retains the simple 3-point merge as well.
> 
> It works for this simple case, but I think it has unfortunate potential
> to go silently wrong.
That just means that you want to have two commands.  One for the people that when the remove a patch, they want it gone.  The other for people that when they remove a patch, they want it to magically reappear.  I’m of the former class of individuals.  Now, I would argue that that is the wrong solution of course.  See below for uncherry-pick.
Now, if I needed a solution to the one problem that was mentioned, I would then request an uncherry-pick command to undo the cherry-pick.  The semantics of it are, the patch is removed from the tree, and when merged, that patch isn’t removed from the source.  See, we then retain the useful property that everything that should work does, and the system is predictable because it then does exactly what the user said to do.  Conceptually of course, it doesn’t have anything to do with cherry, if you merge a branch accidentally, and then remove it, and merge it, I think you still wind up with the work being removed.  Conceptually, it is just an undo a change, cherry, merge, file rename, whatever.
Now, why is this preferable?  Because the advanced user gets to explain what they want to git, and then git does what they want.  It also works for beginning users, it does what they ask it to do.  If you are afraid you know better what command that they really wanted to use instead of the command they are using, you can prompt them and ask, did you mean this or that?  After 20 times being asked, it would get old and then even a new user would just issue the commands they want.  I’m not in favor of that, I’d prefer that the system just do what they tell it to do.
> Also, it prevents fully removing (commits, not only refs) the branch
> you cherry-picked from.  The commit you cherry picked may no longer
> be (or may no longer should be) in the repository.
I’m picking from trunk, when it goes, I go.  :-)
> Also, this could be avoided by using feature branches and merging
> instead of committing to one branch and cherry-picking to other
> branches.
If the problem remains unfixed, at least the documentation should be changed to say cherry will mess up merge.  If you never merge, never a problem.  For me, I would read that, and say, well, trivially, cherry isn’t for me (til they fix the bug that causes it to mess up merges).  I can’t see anything on http://git-scm.com/docs/git-cherry-pick which says it will mess up merges.
Previous: Jakub NarębskiNext: Nico Williams
Message 39 of 43 in “cherry picking and merge”
  1. Mike StumpAug 1, 2014
  2. brian m. carlsonAug 1, 2014
  3. Jakub NarębskiAug 1, 2014
  4. Mike StumpAug 1, 2014
  5. Philip OakleyAug 1, 2014
  6. Mike StumpAug 1, 2014
  7. Philip OakleyAug 2, 2014
  8. Philip OakleyAug 2, 2014
  9. Sam VilainAug 1, 2014
  10. Mike StumpAug 1, 2014
  11. Nico WilliamsAug 1, 2014
  12. Alex DavidsonAug 2, 2014
  13. Mike StumpAug 6, 2014
  14. Rebase safely (Re: cherry picking and merge)Nico Williams, Aug 6, 2014
  15. Nico WilliamsAug 6, 2014
  16. Mike StumpAug 1, 2014
  17. Keller, Jacob EAug 21, 2014
  18. Keller, Jacob EAug 21, 2014
  19. Nico WilliamsAug 1, 2014
  20. Mike StumpAug 1, 2014
  21. Nico WilliamsAug 1, 2014
  22. Jonathan NiederAug 1, 2014
  23. Jonathan NiederAug 1, 2014
  24. Nico WilliamsAug 1, 2014
  25. Junio C HamanoAug 1, 2014
  26. Nico WilliamsAug 1, 2014
  27. Junio C HamanoAug 1, 2014
  28. Jakub NarębskiAug 6, 2014
  29. Nico WilliamsAug 6, 2014
  30. Junio C HamanoAug 6, 2014
  31. Junio C HamanoAug 6, 2014
  32. Mike StumpAug 1, 2014
  33. Mike StumpAug 1, 2014
  34. Jonathan NiederAug 1, 2014
  35. Fwd: cherry picking and mergeJakub Narębski, Aug 1, 2014
  36. Mike StumpAug 1, 2014
  37. Philip OakleyAug 2, 2014
  38. Jakub NarębskiAug 6, 2014
  39. Mike StumpAug 6, 2014
  40. Nico WilliamsAug 7, 2014
  41. Mike StumpAug 8, 2014
  42. Nico WilliamsAug 8, 2014
  43. Fwd: Rebase safely (Re: cherry picking and merge)Mike Stump, Aug 8, 2014

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.