{"thread":{"id":"36966","subject":"search for equivalent commits by patch-id","startedAt":"2014-06-19T12:26:17Z","lastAt":"2014-06-20T07:43:46Z","messageCount":2,"participants":["vicentiu.neagoe@ni.com","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"244642","messageId":"53A2D6E9.30341.4A8A1942@vicentiu.neagoe.ni.com","threadId":"36966","inReplyTo":null,"subject":"search for equivalent commits by patch-id","fromName":"","fromEmail":"vicentiu.neagoe@ni.com","sentAt":"2014-06-19T12:26:17Z","receivedAt":"2014-06-19T12:26:17Z","isPatch":false,"sender":{"key":"vicentiu.neagoe@ni.com","avatar":null},"body":"Hello,\n\nIs there a way to find all equivalent commits by patch-id?\n\nSomething similar to:\n\ngit branch -a --commit <commit>\n\nbut instead of <commit> to search by patch-id.\n\nthanks\n\nVicentiu\n"},{"id":"244746","messageId":"20140620074346.GA3778@sigill.intra.peff.net","threadId":"36966","inReplyTo":"53A2D6E9.30341.4A8A1942@vicentiu.neagoe.ni.com","subject":"Re: search for equivalent commits by patch-id","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-06-20T07:43:46Z","receivedAt":"2014-06-20T07:43:46Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 19, 2014 at 03:26:17PM +0300, vicentiu.neagoe@ni.com wrote:\n\n> Is there a way to find all equivalent commits by patch-id?\n> \n> Something similar to:\n> \n> git branch -a --commit <commit>\n> \n> but instead of <commit> to search by patch-id.\n\nThere isn't a ready-made command to do so, but you can easily script it:\n\n  git for-each-ref --format='%(refname)' refs/heads |\n  while read ref; do\n\techo \"$(git diff-tree -p \"$ref\" | git patch-id) $ref\"\n  done |\n  grep $PATCH_ID_YOU_ARE_LOOKING_FOR\n\nIf you want to look further back than the tips, you can feed the\nbranches to rev-list, and then patch-id each commit you find.\n\nThe more common way to use patch-ids is to look for commits that are in\none branch but not another. For that, try the \"--cherry-pick\" and\n\"--cherry-mark\" options to \"git log\".\n\n-Peff\n"}]}