11

What is the meaning of the word cherry in git-cherry?


Besides the fruit, I've only seem the word in the cherry picking expression (also present in git with git-cherry-pick), that means selectively picking something (right?).

Doesn't look like to me that cherry in git-cherry is related to the fruit neither to cherry pick.

I'm Brazilian so subtleties of the English language are not quite so obvious sometimes.

talles
  • 14,356
  • 8
  • 45
  • 58
  • This question appears to be off-topic because it is about A word's meaning; not programming. Try English.SE. – George Stocker Dec 16 '13 at 13:09
  • @GeorgeStocker English.SE wouldn't fit because I'm not asking the meaning of the word cherry per se; I'm asking in the context of git (what it means **in that git command**). That questions makes sense only here. – talles Dec 16 '13 at 13:12
  • Git didn't re-invent the word 'cherry', if that's what you're asking. The meaning of the word 'cherry-pick' is best given on English.SE. – George Stocker Dec 16 '13 at 13:15
  • @GeorgeStocker Note that in the question itself I state the cherry-pick word (there's even no edit in my question). But the word it's just plain **cherry**, that makes no sense. Well, at least it didn't make sense for me since I don't use the command alongside with cherry picking, it's just a way for me to check what I'm pushing (see answer comments). I learned that the purpose of the command in the end it is related to the command git-cherry-pick, that's why the word cherry (and then, after the answer, it made sense to me). – talles Dec 16 '13 at 13:32
  • This confusion is a well known characteristic (and, for some, issue) of git; git reuses it's commands all the time and sometime it's not a so-obvious way (git checkout anyone?). In the end I'm fine if you want to close the question, I got it answered and I learned what I wished to learn. But note that this question would be not only completely off-topic on English.SE, but also impossible to answer without knowing git. – talles Dec 16 '13 at 13:36

1 Answers1

13

It's called cherry-pick because the task is like cherry picking. You look through a bunch of commits (in a real tree, leaves and branches) and carefully select some of them. It's a delicate job the same way cherry picking in real-world is.

git-cherry is related to git-cherry-pick. git-cherry reports which commits do not exist in a branch. In other words, it returns which commits can be cherry-picked, i.e. which commits are cherries (so they can be picked).

Shahbaz
  • 46,337
  • 19
  • 116
  • 182
  • So in the end it is related to cherry-picking. Not really obvious as with git-cherry-pick but that makes sense. – talles Dec 11 '13 at 16:33
  • @talles, well, what you do in `git-cherry-pick` is to take a commits from another branch into your branch. With `git-cherry`, it shows you what commits in another branch are not already in your branch. While with `git-cherry-pick`, you pick cherries, with `git-cherry` you see the cherries ;) Admittedly, `git cherry pick` would have made more sense than `git cherry-pick` (i.e., as a subcommand rather than another command), analogous to `git branch name` vs `git branch`. – Shahbaz Dec 11 '13 at 17:03
  • Ya, makes sense. Wasn't that obvious for me at the first because most of the time I use `git cherry` to check what I'm pushing (similar to hg's outgoing command). – talles Dec 11 '13 at 17:13
  • @talles, hah, it never occurred to me to check what I'm pushing. I usually check what I'm fetching (before merge) and with `git diff`. It always seemed to me that what I'm pushing is ok, since it's my own local branch. – Shahbaz Dec 11 '13 at 17:28
  • nice mnemonic trick. Maybe I'll be able to keep that in my mind now. :-) – hillu Dec 11 '13 at 19:42