emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: git log question


From: Yuri Khan
Subject: Re: git log question
Date: Thu, 30 Nov 2017 20:15:51 +0700

On Thu, Nov 30, 2017 at 7:02 PM, Stephen Berman <address@hidden> wrote:

> I want to call `git
> <command> <commit>' on a branch and see the commit only if it is indeed
> on that branch, not on some other branch in the repository.  From your
> reply, it appears that git does not have such a command, but I have to
> first call `git branch --contains <commit>' and, if it shows the branch
> I want, then call `git log <commit> -1'.  If so, fine, though a bit
> disappointing it's not more straightforward.

You are trying to do two things at once: (1) determine if a commit is
reachable from a branch, and (2) show the commit. But it seems Git
does not have a command to do exactly that, or any means to intersect
revision ranges in one command.

This works:

    $ git merge-base --is-ancestor <commit> HEAD && git log -1 <commit>

You might be able to define a Git alias to shorten it further.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]