{"thread":{"id":"3954","subject":"How do I quickly check what heads a particular commit is in?","startedAt":"2006-04-24T04:23:24Z","lastAt":"2006-04-24T04:50:35Z","messageCount":4,"participants":["Martin Langhoff","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"19034","messageId":"46a038f90604232123r7f35660aufbb9da0f561f8ea@mail.gmail.com","threadId":"3954","inReplyTo":null,"subject":"How do I quickly check what heads a particular commit is in?","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2006-04-24T04:23:24Z","receivedAt":"2006-04-24T04:23:24Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"In the middle of a merge of 2 of a bunch of closely related heads, I\nfound a few odd things, so I've pickaxe'd and found the (potentially\nbogus) commits. I am using gitk, and while I do find the commit, it's\nnot very clear what heads have the dodgy commit. They've probably been\nfor a few months in there <sigh>.\n\nIs there a practical way to ask in what heads they are?\n\n\n\nmartin\n"},{"id":"19035","messageId":"7v4q0jd1sj.fsf@assigned-by-dhcp.cox.net","threadId":"3954","inReplyTo":"46a038f90604232123r7f35660aufbb9da0f561f8ea@mail.gmail.com","subject":"Re: How do I quickly check what heads a particular commit is in?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-04-24T04:40:12Z","receivedAt":"2006-04-24T04:40:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Martin Langhoff\" <martin.langhoff@gmail.com> writes:\n\n> In the middle of a merge of 2 of a bunch of closely related heads, I\n> found a few odd things, so I've pickaxe'd and found the (potentially\n> bogus) commits. I am using gitk, and while I do find the commit, it's\n> not very clear what heads have the dodgy commit. They've probably been\n> for a few months in there <sigh>.\n>\n> Is there a practical way to ask in what heads they are?\n\ngit merge-base $broken_commit \"master\"\n\nwould show $broken_commit if \"master\" is a fast-forward of\n$broken_commit (i.e. \"master\" is a descendant).  I think that is\nwhat you are calling \"$broken_commit is in master\".\n"},{"id":"19036","messageId":"20060424044138.GA20954@coredump.intra.peff.net","threadId":"3954","inReplyTo":"46a038f90604232123r7f35660aufbb9da0f561f8ea@mail.gmail.com","subject":"Re: How do I quickly check what heads a particular commit is in?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2006-04-24T04:41:38Z","receivedAt":"2006-04-24T04:41:38Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 24, 2006 at 04:23:24PM +1200, Martin Langhoff wrote:\n\n> Is there a practical way to ask in what heads they are?\n\nThis should work:\n\n$ cat <<'EOF' >find-commit\n#!/bin/sh\ncommit=$1; shift\nfor i in \"$@\"; do\n  git rev-list $i | fgrep -q $commit && echo $i\ndone\nEOF\n$ sh find-commit full-40char-sha1-of-commit head1 head2 ...\n\nYou potentially end up traversing parts of the history multiple times\n(if they are shared by multiple heads) but git is fast enough that\nperformance is fine.\n\nI don't know of a way to do it all in a git command without the fgrep.\n\n-Peff\n"},{"id":"19037","messageId":"46a038f90604232150y7c99ceb2sf8f6bf05d701b3d7@mail.gmail.com","threadId":"3954","inReplyTo":"7v4q0jd1sj.fsf@assigned-by-dhcp.cox.net","subject":"Re: How do I quickly check what heads a particular commit is in?","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2006-04-24T04:50:35Z","receivedAt":"2006-04-24T04:50:35Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 4/24/06, Junio C Hamano <junkio@cox.net> wrote:\n> git merge-base $broken_commit \"master\"\n>\n> would show $broken_commit if \"master\" is a fast-forward of\n> $broken_commit (i.e. \"master\" is a descendant).  I think that is\n> what you are calling \"$broken_commit is in master\".\n\nof course! Thanks! I'm in the middle of a somewhat nasty merge, and my\nfingers got all tangled working up and down the history finding what\nheads have this commit. I can now do a loop with bash calling all the\nheads against it. Great!\n\n (hmmm. just had to decide to go back to basics and perform some\nreverts before retrying the merge.)\n\n\nm\n"}]}