All of lore.kernel.org
 help / color / mirror / Atom feed
* is there a way to reference the branch point?
@ 2010-01-29 22:29 layer
  2010-01-29 22:35 ` Sverre Rabbelier
  0 siblings, 1 reply; 3+ messages in thread
From: layer @ 2010-01-29 22:29 UTC (permalink / raw)
  To: git

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?

Thanks.

Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: is there a way to reference the branch point?
  2010-01-29 22:29 is there a way to reference the branch point? layer
@ 2010-01-29 22:35 ` Sverre Rabbelier
  2010-02-03 21:40   ` layer
  0 siblings, 1 reply; 3+ messages in thread
From: Sverre Rabbelier @ 2010-01-29 22:35 UTC (permalink / raw)
  To: layer; +Cc: git

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.

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: is there a way to reference the branch point?
  2010-01-29 22:35 ` Sverre Rabbelier
@ 2010-02-03 21:40   ` layer
  0 siblings, 0 replies; 3+ messages in thread
From: layer @ 2010-02-03 21:40 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: git

Sverre Rabbelier <srabbelier@gmail.com> wrote:

>> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-03 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-29 22:29 is there a way to reference the branch point? layer
2010-01-29 22:35 ` Sverre Rabbelier
2010-02-03 21:40   ` layer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.