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

Re: is there a way to reference the branch point?

From
Llayer <layer@known.net>
Date
Feb 3, 2010, 21:40 UTC
Message-ID
<8481.1265233259@relay.known.net>
In-Reply-To
<fabb9a1e1001291435p59599f62hd54cbca66d91c24b@mail.gmail.com>
Sverre Rabbelier <srabbelier@gmail.com> wrote:
Show 22 quoted lines
>> Heya,
>> 
>> On Fri, Jan 29, 2010 at 23:29, layer <layer@known.net> wrote:
>> > If I make a branch `foo' off master, commit a bunch of times, is there
>> > a way to reference the place on master from which I branched?
>> 
>> Depends, if you make a new branch from master, you can use 'git
>> merge-base', so:
>> 
>> $ # on master
>> $ git checkout -b foo-topic-branch
>> $ # work work
>> $ git commit
>> $ # work work
>> $ git commit
>> 
>> Now you want to know where you branches off from master:
>> 
>> $ git merge-base foo-topic-branch master
>> 
>> That will show you the commit you branches off from, even if master
>> has grown new commits since then.

That works, but what if I don't know it's off master? Normally, a human would, but what if this is a script I'm writing?

Thanks.
Kevin
Previous: Sverre Rabbelier
Message 3 of 3 in “is there a way to reference the branch point?”
  1. layerJan 29, 2010
  2. Sverre RabbelierJan 29, 2010
  3. layerFeb 3, 2010

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.