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

Re: How do I quickly check what heads a particular commit is in?

From
Jeff King <peff@peff.net>
Date
Apr 24, 2006, 04:41 UTC
Message-ID
<20060424044138.GA20954@coredump.intra.peff.net>
In-Reply-To
<46a038f90604232123r7f35660aufbb9da0f561f8ea@mail.gmail.com>
On Mon, Apr 24, 2006 at 04:23:24PM +1200, Martin Langhoff wrote:
> Is there a practical way to ask in what heads they are?
This should work:
$ cat <<'EOF' >find-commit
#!/bin/sh
commit=$1; shift
for i in "$@"; do
  git rev-list $i | fgrep -q $commit && echo $i
done
EOF
$ sh find-commit full-40char-sha1-of-commit head1 head2 ...

You potentially end up traversing parts of the history multiple times (if they are shared by multiple heads) but git is fast enough that performance is fine.

I don't know of a way to do it all in a git command without the fgrep.
-Peff
Previous: Martin Langhoff
Message 4 of 4 in “How do I quickly check what heads a particular commit is in?”
  1. Martin LanghoffApr 24, 2006
  2. Junio C HamanoApr 24, 2006
  3. Martin LanghoffApr 24, 2006
  4. Jeff KingApr 24, 2006

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.