{"thread":{"id":"20590","subject":"git cherry to find equivalent commit IDs?","startedAt":"2009-08-13T21:13:24Z","lastAt":"2009-08-13T23:05:45Z","messageCount":3,"participants":["skillzero@gmail.com","Avery Pennarun"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"120583","messageId":"2729632a0908131413w1a2efca8t31ac8cc43e1d6888@mail.gmail.com","threadId":"20590","inReplyTo":null,"subject":"git cherry to find equivalent commit IDs?","fromName":"","fromEmail":"skillzero@gmail.com","sentAt":"2009-08-13T21:13:24Z","receivedAt":"2009-08-13T21:13:24Z","isPatch":false,"sender":{"key":"skillzero@gmail.com","avatar":null},"body":"Is there a way to get the commit ID of a patch that was cherry picked\n(or via a manually applied patch)? I'm trying to get an equivalent to\ngit branch --contains, but instead of comparing the commit ID, it\ncompares patch IDs so it works for cherry picks and manual patches. It\nseems like git cherry almost does what I want, but it only seems to\nshow the commit ID of the commit on the other branch rather than the\nbranch I specify to git cherry. I may just be using git cherry\nincorrectly though.\n\nFor example, commit 3642151 on branch A was a cherry pick of a commit\n460050c on master:\n\n$ git branch -a --contains 3642151\n  A\n\n$ git branch -a --contains 460050c\n* master\n\n$ git cherry -v master 3642151\n- 3642151435ce5737debc1213de46dd556475bfad1 fixed bug\n\nI assume that means an equivalent change to 3642151 is already in\nmaster (which it is, as commit 460050c). But I want to find out the\ncommit ID on master that's equivalent to 3642151 (i.e. something that\ntells me it's 460050c).\n\nI'm basically looking for something like git branch --contains, but\nthat searches by patch ID so it can find cherry picked or manually\napplied patches:\n\n$ git branch -a --contains-equivalent 3642151\n* master (via commit 460050c)\n  A (via commit 3642151)\n\nIs there a way to do that?\n"},{"id":"120586","messageId":"32541b130908131437g7cb14a1eh6cd2e31a57f105d5@mail.gmail.com","threadId":"20590","inReplyTo":"2729632a0908131413w1a2efca8t31ac8cc43e1d6888@mail.gmail.com","subject":"Re: git cherry to find equivalent commit IDs?","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-08-13T21:37:18Z","receivedAt":"2009-08-13T21:37:18Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Thu, Aug 13, 2009 at 9:13 PM, <skillzero@gmail.com> wrote:\n> For example, commit 3642151 on branch A was a cherry pick of a commit\n> 460050c on master:\n>\n> $ git branch -a --contains 3642151\n>  A\n>\n> $ git branch -a --contains 460050c\n> * master\n>\n> $ git cherry -v master 3642151\n> - 3642151435ce5737debc1213de46dd556475bfad1 fixed bug\n>\n> I assume that means an equivalent change to 3642151 is already in\n> master (which it is, as commit 460050c). But I want to find out the\n> commit ID on master that's equivalent to 3642151 (i.e. something that\n> tells me it's 460050c).\n\ngit show 3642151 | git patch-id\n\nYou should get a line with two hashes; the first is the patchid (call\nit PATCHID_FROM_ABOVE)\n\ngit log -p | git patch-id | grep PATCHID_FROM_ABOVE\n\nThis should give you a list of all commits that correspond to that patchid.\n\nNote that if there were conflicts when applying the patch, the patchid\nprobably changed.\n\nHave fun,\n\nAvery\n"},{"id":"120598","messageId":"2729632a0908131605p62b5e7ddjef9732baea0be84d@mail.gmail.com","threadId":"20590","inReplyTo":"32541b130908131437g7cb14a1eh6cd2e31a57f105d5@mail.gmail.com","subject":"Re: git cherry to find equivalent commit IDs?","fromName":"","fromEmail":"skillzero@gmail.com","sentAt":"2009-08-13T23:05:45Z","receivedAt":"2009-08-13T23:05:45Z","isPatch":false,"sender":{"key":"skillzero@gmail.com","avatar":null},"body":"On Thu, Aug 13, 2009 at 2:37 PM, Avery Pennarun<apenwarr@gmail.com> wrote:\n> On Thu, Aug 13, 2009 at 9:13 PM, <skillzero@gmail.com> wrote:\n>> For example, commit 3642151 on branch A was a cherry pick of a commit\n>> 460050c on master:\n>>\n>> $ git branch -a --contains 3642151\n>>  A\n>>\n>> $ git branch -a --contains 460050c\n>> * master\n>>\n>> $ git cherry -v master 3642151\n>> - 3642151435ce5737debc1213de46dd556475bfad1 fixed bug\n>>\n>> I assume that means an equivalent change to 3642151 is already in\n>> master (which it is, as commit 460050c). But I want to find out the\n>> commit ID on master that's equivalent to 3642151 (i.e. something that\n>> tells me it's 460050c).\n>\n> git show 3642151 | git patch-id\n>\n> You should get a line with two hashes; the first is the patchid (call\n> it PATCHID_FROM_ABOVE)\n>\n> git log -p | git patch-id | grep PATCHID_FROM_ABOVE\n>\n> This should give you a list of all commits that correspond to that patchid.\n\nThat worked perfectly. Thanks.\n"}]}