git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [bug report]: error doing_rebase
@ 2018-02-05 19:26 Bulat Musin
  2018-02-06  9:47 ` Johannes Schindelin
  0 siblings, 1 reply; 3+ messages in thread
From: Bulat Musin @ 2018-02-05 19:26 UTC (permalink / raw)
  To: git

Hi.

To reproduce:

git init testrepo

cd testrepo

echo 1 >> file

git add file

git commit -m'1'

echo 2 >> file

git add file

git commit -m'2'

echo 3 >> file

git add file

git commit -m'3'

Now there are 3 sequential commits, I want to squash them into 1:

git rebase -i HEAD~2

In editor I changed all "pick" to "squash", saved file, I got:

error: cannot 'squash' without a previous commit
You can fix this with 'git rebase --edit-todo' and then run 'git rebase 
--continue'.
Or you can abort the rebase with 'git rebase --abort'.

However, 2.14.1 from Ubuntu's repo does the job - squashes 3 commits into 1.

Thanks.




git version 2.16.1.72.g5be1f00a9


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report]: error doing_rebase
  2018-02-05 19:26 [bug report]: error doing_rebase Bulat Musin
@ 2018-02-06  9:47 ` Johannes Schindelin
       [not found]   ` <0254c12c-e820-9c00-a4d0-2192fca76130@yandex.ru>
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2018-02-06  9:47 UTC (permalink / raw)
  To: Bulat Musin; +Cc: git

Hi,

On Mon, 5 Feb 2018, Bulat Musin wrote:

> Now there are 3 sequential commits, I want to squash them into 1:
> 
> git rebase -i HEAD~2
> 
> In editor I changed all "pick" to "squash", saved file, I got:
> 
> error: cannot 'squash' without a previous commit

You cannot start with a squash. You have to pick the first one, then
squash the second into the first.

> However, 2.14.1 from Ubuntu's repo does the job - squashes 3 commits into 1.

It may be careless enough to do that, however, it might now have modified
the *wrong* commit, i.e. squashed the two patches *into HEAD~2*.

Please verify that your HEAD~2 is still intact and part of the rebased
history, otherwise you will have a problem.

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report]: error doing_rebase
       [not found]   ` <0254c12c-e820-9c00-a4d0-2192fca76130@yandex.ru>
@ 2018-02-07 14:12     ` Johannes Schindelin
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2018-02-07 14:12 UTC (permalink / raw)
  To: Bulat Musin; +Cc: git

Hi Bulat,

Please make sure to keep the Git mailing list in Cc: (I get *very* prickly
when Git users treat me as a free-of-cost help desk, and when I get that
annoyed, I stop helping).

On Tue, 6 Feb 2018, Bulat Musin wrote:

> Yes, I tested again.
> 
> With built 2.16... and it shows error message. git rebase --abort restores
> 
> state before rebase.

You misunderstood me. I am convinced that that error message *is correct*.
It shows an incorrect usage. You cannot start off an interactive rebase by
a `squash` command.

> With git 2.14 from Ubuntu's repo it works - 3 commits are squashed into first
> one

Yes, but you called `git rebase -i HEAD~2`, which means that only two
commits were up for rebasing. The third commit is outside the range
`HEAD~2..` which the command `git rebase -i HEAD~2` wants to let you rebase.

If v2.14 indeed modified `HEAD~2` (as I suspected in my earlier mail),
then you successfully confirmed that we fixed a bug, and that you expected
the buggy behavior.

> - with change SHA.
> 
> It seems to be bug in recent version.
> 
> Should I provide additional information?

Ciao,
Johannes

> On 02/06/2018 12:47 PM, Johannes Schindelin wrote:
> > Hi,
> >
> > On Mon, 5 Feb 2018, Bulat Musin wrote:
> >
> > > Now there are 3 sequential commits, I want to squash them into 1:
> > >
> > > git rebase -i HEAD~2
> > >
> > > In editor I changed all "pick" to "squash", saved file, I got:
> > >
> > > error: cannot 'squash' without a previous commit
> > You cannot start with a squash. You have to pick the first one, then
> > squash the second into the first.
> >
> > > However, 2.14.1 from Ubuntu's repo does the job - squashes 3 commits into
> > > 1.
> > It may be careless enough to do that, however, it might now have modified
> > the *wrong* commit, i.e. squashed the two patches *into HEAD~2*.
> >
> > Please verify that your HEAD~2 is still intact and part of the rebased
> > history, otherwise you will have a problem.
> >
> > Ciao,
> > Johannes
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-07 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05 19:26 [bug report]: error doing_rebase Bulat Musin
2018-02-06  9:47 ` Johannes Schindelin
     [not found]   ` <0254c12c-e820-9c00-a4d0-2192fca76130@yandex.ru>
2018-02-07 14:12     ` Johannes Schindelin

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).