From: David Brown Date: Fri, 20 Jan 2012 18:06:20 GMT Subject: Re: [Q] Determing if a commit is reachable from the HEAD ? Message-ID: <20120120180620.GA8504@codeaurora.org> In-Reply-To: On Fri, Jan 20, 2012 at 03:13:58PM +0100, Andreas Schwab wrote: > Brian Foster writes: > > > In a script, how can I determine commit Y is reachable > > from the current HEAD ? > > test $(git merge-base HEAD Y) = $(git rev-parse Y) Almost. It works as long as there is only one merge base. You really need to check if $(git rev-parse Y) is one of $(git merge-base --all HEAD Y) if HEAD is a named branch, you can do git name-rev --refs=refs/heads/branchname Y which will give you Y relative to branchname if it is contained within it. David -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.