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

RE: Show containing branches in log?

From
Jason Pyeron <jpyeron@pdinc.us>
Date
Jul 2, 2014, 16:52 UTC
Message-ID
<6C120F968C534117BC278DD93D1F84A5@black>
In-Reply-To
<20140702163451.GB14404@sigill.intra.peff.net>
Show 31 quoted lines
> -----Original Message-----
> From: Jeff King
> Sent: Wednesday, July 02, 2014 12:35
> 
> On Wed, Jul 02, 2014 at 09:50:57AM -0500, Robert Dailey wrote:
> 
> > I know that with the `git branch` command I can determine which
> > branches contain a commit. Is there a way to represent this
> > graphically with `git log`? Sometimes I just have a commit, 
> and I need
> > to find out what branch contains that commit. The reason why `git
> > branch --contains` doesn't solve this problem for me is 
> that it names
> > almost all branches because of merge commits. Too much ancestry has
> > been built since this commit, so there is no way to find 
> the "closest"
> > branch that contains that commit.
> > 
> > Is there a way to graphically see what is the "nearest" named ref to
> > the specified commit in the logs?
> 
> 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).

Another way I answer this question is git log --oneline --graph --all and then search for the commit and follow the lines.

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.
 
Previous: Robert DaileyNext: Robert Dailey
Message 4 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.