git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: A couple of minor branching questions

From
Jakub Narebski <jnareb@gmail.com>
Date
Feb 24, 2009, 01:29 UTC
Message-ID
<m3tz6kvd0b.fsf@localhost.localdomain>
In-Reply-To
<1235435927.12677.2.camel@rottwang.fnordora.org>
Alan <alan@clueserver.org> writes:
Show 6 quoted lines
> 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
Previous: Alan
Message 2 of 2 in “A couple of minor branching questions”
  1. AlanFeb 24, 2009
  2. Jakub NarebskiFeb 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.