[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.
- git log question, Stephen Berman, 2017/11/30
- Re: git log question, Mathias Megyei, 2017/11/30
- Re: git log question, Stephen Berman, 2017/11/30
- Re: git log question,
Yuri Khan <=
- Re: git log question, Stephen Berman, 2017/11/30
- Re: git log question, Noam Postavsky, 2017/11/30
- Re: git log question, Yuri Khan, 2017/11/30
- Re: git log question, Andreas Schwab, 2017/11/30
- Re: git log question, Kaushal Modi, 2017/11/30
- Re: git log question, Andreas Schwab, 2017/11/30
- Re: git log question, Noam Postavsky, 2017/11/30
- Re: git log question, Davis Herring, 2017/11/30
Re: git log question, Herring, Davis, 2017/11/30