* rebase --onto might "loose" commits
@ 2008-02-19 7:23 Björn Steinbrink
2008-02-19 11:05 ` Johannes Schindelin
0 siblings, 1 reply; 4+ messages in thread
From: Björn Steinbrink @ 2008-02-19 7:23 UTC (permalink / raw)
To: gitster, Johannes.Schindelin; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 428 bytes --]
Hi,
when there's nothing to rebase (ie. upstream..branch is empty), rebase
fails to find any commits to rebase and correctly says "Nothing to do",
but when --onto is given, we already did a "reset --hard" to newbase, so
it already _did_ something.
As rebase also shows a "fatal: Not a range", during the operation, I
assume that this is an actual bug and not just a plain user error.
A test script is attached.
Thank,
Björn
[-- Attachment #2: test.sh --]
[-- Type: application/x-sh, Size: 616 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: rebase --onto might "loose" commits
2008-02-19 7:23 rebase --onto might "loose" commits Björn Steinbrink
@ 2008-02-19 11:05 ` Johannes Schindelin
2008-02-19 12:52 ` Björn Steinbrink
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2008-02-19 11:05 UTC (permalink / raw)
To: Björn Steinbrink; +Cc: gitster, git
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1034 bytes --]
Hi,
On Tue, 19 Feb 2008, Björn Steinbrink wrote:
> when there's nothing to rebase (ie. upstream..branch is empty), rebase
> fails to find any commits to rebase and correctly says "Nothing to do",
> but when --onto is given, we already did a "reset --hard" to newbase, so
> it already _did_ something.
Yes, it did something. But if you had that:
A - B - C - D - E
\
F
your HEAD was E, and you said "git rebase --onto F E" what exactly do you
want it to do? There is no commit between E and E, so it rebases
_nothing_ onto F. Which means that F should be your new state.
Unless I am missing something critical in your mail.
> As rebase also shows a "fatal: Not a range", during the operation, I
> assume that this is an actual bug and not just a plain user error.
That message is probably a bug, then.
Ciao,
Dscho
P.S.: I was being corrected some time ago on the same typo: "to lose"
means to get rid of something unintentionally, "to loose" does not exist,
and "to loosen" means to make something less tight.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: rebase --onto might "loose" commits
2008-02-19 11:05 ` Johannes Schindelin
@ 2008-02-19 12:52 ` Björn Steinbrink
2008-02-19 14:43 ` Nicolas Pitre
0 siblings, 1 reply; 4+ messages in thread
From: Björn Steinbrink @ 2008-02-19 12:52 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: gitster, git
Hi,
On 2008.02.19 11:05:40 +0000, Johannes Schindelin wrote:
> On Tue, 19 Feb 2008, Björn Steinbrink wrote:
>
> > when there's nothing to rebase (ie. upstream..branch is empty), rebase
> > fails to find any commits to rebase and correctly says "Nothing to do",
> > but when --onto is given, we already did a "reset --hard" to newbase, so
> > it already _did_ something.
>
> Yes, it did something. But if you had that:
>
> A - B - C - D - E
> \
> F
>
> your HEAD was E, and you said "git rebase --onto F E" what exactly do you
> want it to do? There is no commit between E and E, so it rebases
> _nothing_ onto F. Which means that F should be your new state.
Strictly, it's correct, but the "Nothing to do" message is a bit
misleading (IMHO) and the error message made me think, that it actually
didn't want to do anything.
I'm a bit unsure about rebase being degraded to a "reset --hard" in this
case is a good idea. Might be a nice user-protection to make rebase
abort when there's nothing to rebase and --onto is given. But I don't
care that much.
Thanks,
Björn
> P.S.: I was being corrected some time ago on the same typo: "to lose"
> means to get rid of something unintentionally, "to loose" does not exist,
> and "to loosen" means to make something less tight.
Ah yeah, one of my preferred typos. There's about a 50% chance for me to
get that right. Although it already felt wrong when I read over the
mail, for some unknown reason I couldn't put my finger on the typo. ;-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: rebase --onto might "loose" commits
2008-02-19 12:52 ` Björn Steinbrink
@ 2008-02-19 14:43 ` Nicolas Pitre
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Pitre @ 2008-02-19 14:43 UTC (permalink / raw)
To: Björn Steinbrink; +Cc: Johannes Schindelin, gitster, git
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1515 bytes --]
On Tue, 19 Feb 2008, Björn Steinbrink wrote:
> Hi,
>
> On 2008.02.19 11:05:40 +0000, Johannes Schindelin wrote:
> > On Tue, 19 Feb 2008, Björn Steinbrink wrote:
> >
> > > when there's nothing to rebase (ie. upstream..branch is empty), rebase
> > > fails to find any commits to rebase and correctly says "Nothing to do",
> > > but when --onto is given, we already did a "reset --hard" to newbase, so
> > > it already _did_ something.
> >
> > Yes, it did something. But if you had that:
> >
> > A - B - C - D - E
> > \
> > F
> >
> > your HEAD was E, and you said "git rebase --onto F E" what exactly do you
> > want it to do? There is no commit between E and E, so it rebases
> > _nothing_ onto F. Which means that F should be your new state.
>
> Strictly, it's correct, but the "Nothing to do" message is a bit
> misleading (IMHO) and the error message made me think, that it actually
> didn't want to do anything.
Yes, the message should probably be changed in that case.
> I'm a bit unsure about rebase being degraded to a "reset --hard" in this
> case is a good idea. Might be a nice user-protection to make rebase
> abort when there's nothing to rebase and --onto is given. But I don't
> care that much.
The "reset --hard" in that case is really the correct behavior. Rebase
might be used like 'git pull --rebase', and if your local branch
contains no commits of your own then the 'git reset --hard' is really
what needs to happen.
The "user protection" lives in the reflog.
Nicolas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-19 14:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-19 7:23 rebase --onto might "loose" commits Björn Steinbrink
2008-02-19 11:05 ` Johannes Schindelin
2008-02-19 12:52 ` Björn Steinbrink
2008-02-19 14:43 ` Nicolas Pitre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox