From: Junio C Hamano Date: Mon, 09 Dec 2013 20:11:50 GMT Subject: Re: [RFC/PATCH] rebase: use reflog to find common base with upstream Message-ID: In-Reply-To: <9e5fa57b027e1a5cd11a456c14f43b64f8f5386c.1386531376.git.john@keeping.me.uk> John Keeping 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 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).