is there a way to reference the branch point?

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

is there a way to reference the branch point?

From: layer <hidden>
Date: 2016-06-15 22:48:08

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

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

From: Sverre Rabbelier <hidden>
Date: 2016-06-15 22:48:08

Heya,

On Fri, Jan 29, 2010 at 23:29, layer [off-list ref] 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

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

From: layer <hidden>
Date: 2016-06-15 22:48:10

Sverre Rabbelier [off-list ref] wrote:
quoted
Heya,

On Fri, Jan 29, 2010 at 23:29, layer [off-list ref] wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help