Re: [RFC/PATCH] rebase: use reflog to find common base with upstream
- From
John Keeping <john@keeping.me.uk>
- Date
- Dec 9, 2013, 20:40 UTC
- Message-ID
- <20131209204008.GF3163@serenity.lan>
- In-Reply-To
- <xmqq7gbdzsvt.fsf@gitster.dls.corp.google.com>
On Mon, Dec 09, 2013 at 12:11:50PM -0800, Junio C Hamano wrote:
Show 48 quoted lines
> John Keeping <john@keeping.me.uk> writes:
>
> > Last time this came up [1], there was some discussion about moving the
> > added block of code to affect upstreams given on the command line as
> > well as when the upstream is discovered from the config. Having tried
> > that, it has some more fallout on the test suite than I like; this
> > pattern ends up dropping the tip commit of "side" because it's in the
> > reflog of "master":
> >
> > # start on "master"
> > git branch side &&
> > git reset --hard HEAD^ &&
> > git checkout side &&
> > git rebase master
>
> We shouldn't do anything funky using the reflog when an explicit
> commit object name was given like in the last step above, I think.
> Automation to help human end-users is good, but at some level there
> must be a mechanism to reliably reproduce the same result given the
> same precondition for those who implement such automation, and I do
> not think it is a good idea to force scripts to say
>
> git rebase --do-not-look-at-reflog master
>
> in order to do so.
>
> > I wonder if it would be better to add a --fork-point argument to
> > git-rebase and default it to true when no upstream is given on the
> > command line.
>
> I am not sure what you exactly mean by "when no upstream is given",
> though. Do you mean
>
> git rebase <no other arguments>
>
> which we interpret as "rebase the current branch on @{u}", and it
> should behave as if the command was run like so:
>
> git rebase --fork-point @{u}
>
> If that is what you suggest, I certainly can buy that. Those who
> want to disable the automation can explicitly say
>
> git rebase @{u}
>
> and rebase the current exactly on top of the named commit (e.g. the
> current value of refs/remotes/origin/master or whatever remote-tracking
> branch you forked from).Yes, that's what I meant; the first non-option argument to "git rebase" is called "upstream" in the manpage (and throughout the code). So if "<no other arguments>" means "<no non-option arguments>" then that's exactly what I meant.