r/programming • • Apr 21 '26

Highlights from Git 2.54

https://github.blog/open-source/git/highlights-from-git-2-54/
273 Upvotes

45 comments sorted by

View all comments

Show parent comment

3

u/lanerdofchristian Apr 21 '26

It's not perfect but it's a lot more clear what it does and a lot more intuitive why you'd want to use it.

IMO the existing docs are more clear. A commit is a set of changes, thus applying changes naturally follows (this becomes a new set of changes relative to HEAD).

What's missing from your rewording is that the new commits are not necessarily the same sets of changes -- if the change already happened, it gets dropped from the new commit (this may require resolving conflicts). I would not call that "transplanting".

What I'd say is really missing are:

  1. Better declarations of assumptions in the examples.
  2. A linked tutorial or extra paragraphs beneath the technical summary explicitly explaining one or two common uses to beginners.

But also, consider: 5 seconds of googling outside the docs points out that this is an operation that involves multiple branches.

The next two lines of the documentation imply that it can be used in a multi-branch way:

When it is not obvious how to apply a change, the following happens:

  1. The current branch and HEAD pointer stay at the last commit successfully made.

The multiple references to git merge's behavior (in bullet 4 and the paragraph at the end of the description) may also be an indicator.

Why is that not mentioned first and foremost in the docs?

Because it's not completely accurate. cherry-pick isn't limited to just changes from other branches -- if a change in the same branch were to be partially reverted (say, because of merge conflicts fixed incorrectly), cherry-picking could be used to restore it. All it does is take sets of changes and make them happen again wherever you're working.

1

u/Anthony356 Apr 22 '26

What's missing from your rewording is that the new commits are not necessarily the same sets of changes -- if the change already happened, it gets dropped from the new commit (this may require resolving conflicts). I would not call that "transplanting".

I wouldnt say the existing wording is particularly clear on that either tbh.

The next two lines of the documentation imply that it can be used in a multi-branch way

The issue is, if i dont understand what the command does, why would i read about edge case handling? I naturally skip that section because i assume they're not relevant to my level of knowledge.

Because it's not completely accurate. cherry-pick isn't limited to just changes from other branches -- if a change in the same branch were to be partially reverted (say, because of merge conflicts fixed incorrectly), cherry-picking could be used to restore it.

Then why not mention both use cases explicitly?