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

How to find a revision's branch name

From
MCMarco Costalba <mcostalba@gmail.com>
Date
Mar 18, 2006, 06:02 UTC
Message-ID
<e5bfff550603172202ia4b69f2he5562b826e491426@mail.gmail.com>
In today git archive, todo branch.

$ git-rev-list -n1 --header b14e2494b8a70737066f4ade4df1b5559e81b44b b14e2494b8a70737066f4ade4df1b5559e81b44b tree 1baa1f8405d1fef90fe95f2477133a69adec288b parent 8158d510c641e2354cf24a10bc3e994c7a1e3125 author Junio C Hamano <junkio@cox.net> 1137562948 -0800 committer Junio C Hamano <junkio@cox.net> 1137562948 -0800

    TODO updates 2006-01-17.
    Signed-off-by: Junio C Hamano <junkio@cox.net>

Is it possible to get branch name from a revision sha? Something like

$ git branch b14e2494b8a70737066f4ade4df1b5559e81b44b todo

I need this to correctly annotate files not in HEAD tree. Currently qgit runs git-rev-list --header --topo-order --parents --remove-empty HEAD -- <path>

to get a file history. But this fails if <path> is not found in HEAD. The right command to run in our case should be: git-rev-list --header --topo-order --parents --remove-empty todo -- <path>

So I need to get 'todo' branch name from a given revision sha's.
BTW also git blame fails (gracefully) if revision is not in HEAD:

$ git blame b14e2494b8a70737066f4ade4df1b5559e81b44b b14e2494b8a70737066f4ade4df1b5559e81b44b not found in HEAD

Thanks Marco

Next: Junio C Hamano
Message 1 of 4 in “How to find a revision's branch name”
  1. Marco CostalbaMar 18, 2006
  2. Junio C HamanoMar 18, 2006
  3. Marco CostalbaMar 18, 2006
  4. Junio C HamanoMar 18, 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.