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

Re: how to know this commit is merged by whic commit

From
Jeff King <peff@peff.net>
Date
Jun 13, 2012, 21:34 UTC
Message-ID
<20120613213435.GA25301@sigill.intra.peff.net>
In-Reply-To
<CAHsH0E9HooVsAq8NhWm-OSk7gSPFMmoYHsArtYqhwTmE0ngwjA@mail.gmail.com>
On Thu, Jun 14, 2012 at 12:50:59AM +0800, lei yang wrote:
> I have a question as the title indicate. assume the commmit id is
> ee5r3343. how to know this commit is merged by  which commit?

There is not one answer to "which commit"; there may be an infinite number of commits which merge it into something else. The best you can do is start at some point (e.g., the tip of "master") and walk backwards looking for commits which merge it (and you still may find multiple, if the commit was merged into two other lines of development, each of which was merged into your starting point). There is not an option to do this search automatically, so you would have to use grep, like:

  git log --format='%H %P' |
  grep " $commit" |
  cut -d' ' -f1

which will list the id of all commits (%H) for which $commit appears in the list of parents (%P).

-Peff
PS You didn't give any background on your problem, but you may also find
   "git tag --contains" and "git branch --contains" useful.
Previous: lei yangNext: Junio C Hamano
Message 2 of 3 in “how to know this commit is merged by whic commit”
  1. lei yangJun 13, 2012
  2. Jeff KingJun 13, 2012
  3. Junio C HamanoJun 13, 2012

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.