Re: Testing if a certain commit is in the current branch
- From
- Frans Pop <elendil@planet.nl>
- Date
- Jan 27, 2010, 15:39 UTC
- Message-ID
- <201001271639.44167.elendil@planet.nl>
- In-Reply-To
- <E1Na9ca-0004x2-Gf@xyzzy.farnsworth.org>
On Wednesday 27 January 2010, Dale Farnsworth wrote:
> I've been using the following. It produces output only if the commit > is NOT in HEAD. > > git rev-list -1 ^HEAD commitID
Nice. That does work.
Returns 0 in both cases and you'd need to allow for nonexisting commit IDs, so you'd get: test -z "$(git rev-list -1 ^HEAD <commit id> 2>/dev/null)"
Time needed looks to be slightly faster than Junio's test.
Thanks, FJP