Subject: Re: git rebase: yet another newbie quest.

From: Sergey Organov <[email-masked]>
Date: Mon, 08 Sep 2014 17:52:44 +0400

Theodore Ts'o <[email-masked]> writes:
> I'm not going to say what you *should* have done, since it's not clear
> whether anything close to what you were doing is a supported workflow.
> But I can tell you what I *do* myself.  Personally, I vastly distrust
> git pull --rebase.

Thank you for sharing your experience!

In the particular case at hand though, "git rebase" is the actual cause
of the problem, not "git pull --rebase".

> So in general, my pulls are all the equivalent of "git pull
> --ff-only", and if I want to rebase the topic branch (which in
> general, is a bad idea to do regularly; I will generally not do it at
> all until I'm almost done).  So I'll branch the topic branch off of
> origin (which tracks origin/master, typically):
>
> git checkout -b topic1 origin
> <hack hack hack>
> git commit
>
>   ...
> <make>
>
> In general, I will only rebase a topic branch when it's needed to fix
> a serious conflcit caused by significant changes upstream.  And in
> that case, I might do something like this:
>
> git checkout topic1
> git rebase origin/master
> <make>
> <make check>

Yeah, it's a good way to do things, but for most of quick fixes I'm lazy
to create topic branch, and in this case it lead to a nasty unexpected
trouble.

I didn't intend to make topic branch from the very beginning, and
already made a commit or two on the remote tracking branch bofore I
realized I'd better use topic branch. It'd create no problem as far as I
can see, provided vanilla "git rebase" has "sane" defaults. That said,
I've already been once pointed to by Junio that my definition of "sane"
doesn't take into account workflows of others, so now I try to be
carefull calling vanilla "git rebase" names.

Please also notice that I didn't pull immediately after I've re-arranged
my branches, and this fact only made it more difficult to find and
isolate the problem.

[...]

> P.S.  There is a separate, and completely valid discussion which is
> how to prevent a newbie from falling into a same trap you did.  I'll
> defer that discussion to others...

Yeah, it'd be fine if at least documentation is fixed.

-- 
Sergey.