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

git cherry to find equivalent commit IDs?

From
Sskillzero@gmail.com <skillzero@gmail.com>
Date
Aug 13, 2009, 21:13 UTC
Message-ID
<2729632a0908131413w1a2efca8t31ac8cc43e1d6888@mail.gmail.com>

Is there a way to get the commit ID of a patch that was cherry picked (or via a manually applied patch)? I'm trying to get an equivalent to git branch --contains, but instead of comparing the commit ID, it compares patch IDs so it works for cherry picks and manual patches. It seems like git cherry almost does what I want, but it only seems to show the commit ID of the commit on the other branch rather than the branch I specify to git cherry. I may just be using git cherry incorrectly though.

For example, commit 3642151 on branch A was a cherry pick of a commit 460050c on master:

$ git branch -a --contains 3642151
  A
$ git branch -a --contains 460050c
* master
$ git cherry -v master 3642151
- 3642151435ce5737debc1213de46dd556475bfad1 fixed bug

I assume that means an equivalent change to 3642151 is already in master (which it is, as commit 460050c). But I want to find out the commit ID on master that's equivalent to 3642151 (i.e. something that tells me it's 460050c).

I'm basically looking for something like git branch --contains, but that searches by patch ID so it can find cherry picked or manually applied patches:

$ git branch -a --contains-equivalent 3642151
* master (via commit 460050c)
  A (via commit 3642151)
Is there a way to do that?
Next: Avery Pennarun
Message 1 of 3 in “git cherry to find equivalent commit IDs?”
  1. skillzero@gmail.comAug 13, 2009
  2. Avery PennarunAug 13, 2009
  3. skillzero@gmail.comAug 13, 2009

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.