# A couple of minor branching questions

2 messages from 2009-02-24 to 2009-02-24. Participants: Alan, Jakub Narebski.
Thread: https://gitlist.dev/t/17981

## Alan, 2009-02-24 00:38

Subject: A couple of minor branching questions
Message-ID: <1235435927.12677.2.camel@rottwang.fnordora.org>
URL: https://gitlist.dev/e/1235435927.12677.2.camel%40rottwang.fnordora.org

```
Is there an easy way to tell what commit a branch is branched off from?
Also, it there a way to tell what branch the branch is branched off
from? 

I know I can use gitk to give a visual diagram, but I want something I
can feed into a program.

Thanks!

```

## Jakub Narebski, 2009-02-24 01:29

Subject: Re: A couple of minor branching questions
Message-ID: <m3tz6kvd0b.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3tz6kvd0b.fsf%40localhost.localdomain
In-Reply-To: <1235435927.12677.2.camel@rottwang.fnordora.org>

```
Alan <alan@clueserver.org> writes:

> Is there an easy way to tell what commit a branch is branched off from?
> Also, it there a way to tell what branch the branch is branched off
> from? 
> 
> I know I can use gitk to give a visual diagram, but I want something I
> can feed into a program.

First you can check branch.<branchname>.merge configuration option
(with git-config) to check what branch (by _remote_ name) given branch
is based on.

Second, you can use "git merge-base <branchname> <second branch>" to
find common ancestor, i.e. branching point of two branches. By the
way, there is shortcut a..b and a...b for revision ranges: see
documentation in git-rev-parse (or was it git-rev-list?).

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```
