threads / discuss / 4710

rebasing trouble

Subject: rebasing trouble

## tl;dr

8 messages between Jun 29, 2006 and Jun 30, 2006.

replies: 7people: 2as markdown or json

J. Bruce Fields· Jun 29, 2006, 19:47 UTC · lore
I must be missing something obvious:

bfields@puzzle:linux-2.6$ git checkout -b TMP nfs-client-stable^^^ bfields@puzzle:linux-2.6$ git-describe v2.6.17-rc6-g28df955 bfields@puzzle:linux-2.6$ git-rebase --onto v2.6.17 origin Nothing to do. bfields@puzzle:linux-2.6$ git-describe v2.6.17

So the git-rebase just reset TMP to v2.6.17. But I know that nfs-client-stable isn't a subset of origin, so this doesn't make sense to me.

The tree in question is actually at git://linux-nfs.org/~bfields/linux.git, if it matters.

--b.
Junio C Hamano· Jun 29, 2006, 20:04 UTC · re: J. Bruce Fields · lore

Re: rebasing trouble

"J. Bruce Fields" <bfields@fieldses.org> writes:
Show 15 quoted lines
> I must be missing something obvious:
>
> bfields@puzzle:linux-2.6$ git checkout -b TMP nfs-client-stable^^^
> bfields@puzzle:linux-2.6$ git-describe
> v2.6.17-rc6-g28df955
> bfields@puzzle:linux-2.6$ git-rebase --onto v2.6.17 origin
> Nothing to do.
> bfields@puzzle:linux-2.6$ git-describe
> v2.6.17
>
> So the git-rebase just reset TMP to v2.6.17.  But I know that nfs-client-stable
> isn't a subset of origin, so this doesn't make sense to me.
>
> The tree in question is actually at git://linux-nfs.org/~bfields/linux.git, if
> it matters.
It matters of course.  Where is the "origin"?
 
J. Bruce Fields· Jun 29, 2006, 20:22 UTC · re: Junio C Hamano · lore

Re: rebasing trouble

On Thu, Jun 29, 2006 at 01:04:25PM -0700, Junio C Hamano wrote:
Show 19 quoted lines
> "J. Bruce Fields" <bfields@fieldses.org> writes:
> 
> > I must be missing something obvious:
> >
> > bfields@puzzle:linux-2.6$ git checkout -b TMP nfs-client-stable^^^
> > bfields@puzzle:linux-2.6$ git-describe
> > v2.6.17-rc6-g28df955
> > bfields@puzzle:linux-2.6$ git-rebase --onto v2.6.17 origin
> > Nothing to do.
> > bfields@puzzle:linux-2.6$ git-describe
> > v2.6.17
> >
> > So the git-rebase just reset TMP to v2.6.17.  But I know that nfs-client-stable
> > isn't a subset of origin, so this doesn't make sense to me.
> >
> > The tree in question is actually at git://linux-nfs.org/~bfields/linux.git, if
> > it matters.
> 
> It matters of course.  Where is the "origin"?

I realized after I sent that that "origin" in that public repository actually isn't the same as "origin" in the local repo that I'm working on. So I just ran a GIT_DIR=. git-fetch there, and now both branches agree.

--b.
J. Bruce Fields· Jun 29, 2006, 20:38 UTC · re: J. Bruce Fields · lore

Re: rebasing trouble

On Thu, Jun 29, 2006 at 04:22:34PM -0400, bfields wrote:
> I realized after I sent that that "origin" in that public repository actually
> isn't the same as "origin" in the local repo that I'm working on.  So I just
> ran a GIT_DIR=. git-fetch there, and now both branches agree.
By the way, I should also have said:

bfields@puzzle:git$ git --version git version 1.4.1.rc2

--b.
J. Bruce Fields· Jun 29, 2006, 21:57 UTC · re: J. Bruce Fields · lore

Re: rebasing trouble

On Thu, Jun 29, 2006 at 03:47:23PM -0400, J. Bruce Fields wrote:
Show 12 quoted lines
> I must be missing something obvious:
> 
> bfields@puzzle:linux-2.6$ git checkout -b TMP nfs-client-stable^^^
> bfields@puzzle:linux-2.6$ git-describe
> v2.6.17-rc6-g28df955
> bfields@puzzle:linux-2.6$ git-rebase --onto v2.6.17 origin
> Nothing to do.
> bfields@puzzle:linux-2.6$ git-describe
> v2.6.17
> 
> So the git-rebase just reset TMP to v2.6.17.  But I know that nfs-client-stable
> isn't a subset of origin, so this doesn't make sense to me.

Oops, sorry, I lied; nfs-client-stable *is* a subset of origin, since Linus merged it.

But it *isn't* a subset of v2.6.17.

So the semantics of git-rebase just aren't quite what I expected. It first removes anything that isn't in the given upstream branch, *then* rebases to the commit given after --onto. Which may mean it throws out some stuff that is in the upstream branch even though it isn't yet included as of the given commit.

So what I really meant to do was just
	git-rebase v2.6.17

And rereading the man page, I see that git-rebase was working exactly as advertised. So I'm an idiot. In my defense, it is a little confusing: none of the examples in the man page that use --onto actually need it, and the "upstream" argument probably should be described as a commit or something instead of a branch.

(What is --onto actually useful for?)
--b.
Junio C Hamano· Jun 29, 2006, 22:34 UTC · re: J. Bruce Fields · lore

Re: rebasing trouble

"J. Bruce Fields" <bfields@fieldses.org> writes:
Show 6 quoted lines
> In my defense, it is a little confusing: none of
> the examples in the man page that use --onto actually need it, and the
> "upstream" argument probably should be described as a commit or something
> instead of a branch.
>
> (What is --onto actually useful for?)

Think of it as a replacement of cherry-picking series of patches from remotely related branches.

For example, I maintain two public branches "master" and "next", the former is supposed to be quite stable and the latter to contain sane proposed updates that need to be proven before graduating to "master".

Sometimes I get patches that I have to apply on top of "next" because of textual dependency, but the changes are worthwhile to have it in "master" earlier than the changes the other series depends on.

 o---o---o---o---o master
      \
       o---o---o---o---o next
                        \
                         o---o---o good
	$ git checkout good
        $ git rebase --onto master next
 o---o---o---o---o master
     |            \
     |             o---o---o good
      \
       o---o---o---o---o next
J. Bruce Fields· Jun 29, 2006, 23:45 UTC · re: Junio C Hamano · lore

Re: rebasing trouble

On Thu, Jun 29, 2006 at 03:34:21PM -0700, Junio C Hamano wrote:
Show 25 quoted lines
> For example, I maintain two public branches "master" and
> "next", the former is supposed to be quite stable and the latter
> to contain sane proposed updates that need to be proven before
> graduating to "master".
> 
> Sometimes I get patches that I have to apply on top of "next"
> because of textual dependency, but the changes are worthwhile to
> have it in "master" earlier than the changes the other series
> depends on.
> 
>  o---o---o---o---o master
>       \
>        o---o---o---o---o next
>                         \
>                          o---o---o good
> 
> 	$ git checkout good
>         $ git rebase --onto master next
> 
>  o---o---o---o---o master
>      |            \
>      |             o---o---o good
>       \
>        o---o---o---o---o next
> 

OK, so you're saying "take everything in good but not in next, and try to apply it to master."

I don't know why I find that syntax so counterintuitive.  Something like
	git checkout -b newgood master
	git cherry-pick next..good

would seem more obvious. But I think this has been discussed before. OK, thanks for the explanation.

--b.
Junio C Hamano· Jun 30, 2006, 01:12 UTC · re: J. Bruce Fields · lore

Re: rebasing trouble

"J. Bruce Fields" <bfields@fieldses.org> writes:
Show 6 quoted lines
> I don't know why I find that syntax so counterintuitive.  Something like
>
> 	git checkout -b newgood master
> 	git cherry-pick next..good
>
> would seem more obvious.
Yes.  Everybody loves to hate this syntax.

← back to recent threads