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

Re: Show containing branches in log?

From
RDRobert Dailey <rcdailey.lists@gmail.com>
Date
Jul 2, 2014, 16:52 UTC
Message-ID
<CAHd499Bk6ZG+DDjN1HuC-RFczwd+AGZaUSkXA6a8MsZjOL5H8A@mail.gmail.com>
In-Reply-To
<20140702163451.GB14404@sigill.intra.peff.net>
On Wed, Jul 2, 2014 at 11:34 AM, Jeff King <peff@peff.net> wrote:
Show 8 quoted lines
> Have you tried "git describe --contains --all <commit>"?
>
> To some degree, I fear your question isn't something git can answer. If
> the branch containing the commit has been merged into other branches,
> then they all "contain" the commit. There is not really any reason to
> prefer one over the other ("describe --contains" will try to find the
> "closest" branch, but that is based on heuristics and is not necessarily
> well-defined).

I have not tried that command. Note I mentioned named refs, so nameless branches I'm not worried about. Even if I merge branch A into branch B, branch A is still closest in terms of number of steps to get to the commit, because to get to the commit through B you have to cross over a merge commit. Basically the priority should be directness and distance. The more direct a branch is (i.e. the lesser number of merge commits it goes through to get to the commit) the more relevant it is. As a second condition, distance would be used in cases where the directness of it is the same.

Sorting this in the log graph and seeing it visually (I could even use --simplify-by-decoration) would help me understand the topography of git's history relative to the commit(s) I specify.

Previous: Jeff KingNext: Jason Pyeron
Message 3 of 10 in “Show containing branches in log?”
  1. Robert DaileyJul 2, 2014
  2. Jeff KingJul 2, 2014
  3. Robert DaileyJul 2, 2014
  4. Jason PyeronJul 2, 2014
  5. Robert DaileyJul 2, 2014
  6. Peter KreftingJul 3, 2014
  7. Jeff KingJul 3, 2014
  8. Øyvind A. HolmJul 3, 2014
  9. Robert DaileyAug 1, 2014
  10. Robert DaileyAug 25, 2014

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.