git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH] rebase: use reflog to find common base with upstream

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 9, 2013, 20:11 UTC
Message-ID
<xmqq7gbdzsvt.fsf@gitster.dls.corp.google.com>
In-Reply-To
<9e5fa57b027e1a5cd11a456c14f43b64f8f5386c.1386531376.git.john@keeping.me.uk>
John Keeping <john@keeping.me.uk> writes:
Show 12 quoted lines
> 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).

Previous: Martin von ZweigbergkNext: John Keeping
Message 3 of 5 in “rebase: use reflog to find common base with upstream”
  1. rebase: use reflog to find common base with upstreamJohn Keeping, Dec 8, 2013
  2. Martin von ZweigbergkDec 8, 2013
  3. Junio C HamanoDec 9, 2013
  4. John KeepingDec 9, 2013
  5. rebase: use reflog to find common base with upstreamJohn Keeping, Dec 9, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.