git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how to know this commit is merged by whic commit
@ 2012-06-13 16:50 lei yang
  2012-06-13 21:34 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: lei yang @ 2012-06-13 16:50 UTC (permalink / raw)
  To: git

Hi list

I have a question as the title indicate. assume the commmit id is
ee5r3343. how to know this commit is merged by  which commit?

Thanks
Lei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to know this commit is merged by whic commit
  2012-06-13 16:50 how to know this commit is merged by whic commit lei yang
@ 2012-06-13 21:34 ` Jeff King
  2012-06-13 22:22   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2012-06-13 21:34 UTC (permalink / raw)
  To: lei yang; +Cc: git

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to know this commit is merged by whic commit
  2012-06-13 21:34 ` Jeff King
@ 2012-06-13 22:22   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2012-06-13 22:22 UTC (permalink / raw)
  To: Jeff King; +Cc: lei yang, git

Jeff King <peff@peff.net> writes:

> 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:

Or you can use "git bisect" ;-).

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-13 22:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-13 16:50 how to know this commit is merged by whic commit lei yang
2012-06-13 21:34 ` Jeff King
2012-06-13 22:22   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).