# Strange behavior with git rebase (-i)

5 messages from 2008-02-02 to 2008-02-03. Participants: Stefan (metze) Metzmacher, Johannes Schindelin, Steven Walter.
Thread: https://gitlist.dev/t/11838

## Stefan (metze) Metzmacher, 2008-02-02 10:44

Subject: Strange behavior with git rebase (-i)
Message-ID: <47A44974.7050907@samba.org>
URL: https://gitlist.dev/e/47A44974.7050907%40samba.org

```
Hi,

I just hit a really strange thing:

I was on a branch called 'v4-0-test',
then I did a git rebase -i orgin/v4-0-test
and removed some patches and prefixed all others
with 'edit'.
Then:

git commit --amend
git rebase --continue
git commit --amend
git rebase --continue
git commit --amend
git commit --amend (again)
git branch
 * v4-0-test
git log
 (this showed what I wanted)
git show -p --stat
 (to really make sure that the top revision is the one I want)
git push origin v4-0-test
 And this pushed the top revision BEFORE the rebase!!!
 Because I forgot a 'git rebase --continue' to finalize the rebase.

In the end it's my fault, because I forgot the last rebase --continue,
but I think it's bad that git behaves that way.

Would it be possible to disable some operations while others
are unfinished, git am (-i) might have similar effects.

I was using git 1.5.3.2

Could it be that 6fd2f5e60d4d574ff9e5dd8ce1e229328c785d69 was
created to fix a similar problem?

metze

http://gitweb.samba.org/?p=samba.git;a=commit;h=ec0ee2aa5f4bef32f09a426d91c28c985f843038
and the 10 commits before...:-(



```

## Johannes Schindelin, 2008-02-02 15:42

Subject: Re: Strange behavior with git rebase (-i)
Message-ID: <alpine.LSU.1.00.0802021538300.7372@racer.site>
URL: https://gitlist.dev/e/alpine.LSU.1.00.0802021538300.7372%40racer.site
In-Reply-To: <47A44974.7050907@samba.org>

```
Hi,

On Sat, 2 Feb 2008, Stefan (metze) Metzmacher wrote:

> [started git rebase -i]
> git commit --amend (again)
> git branch
>  * v4-0-test
> git log
>  (this showed what I wanted)
> git show -p --stat
>  (to really make sure that the top revision is the one I want)
> git push origin v4-0-test
>  And this pushed the top revision BEFORE the rebase!!!
>  Because I forgot a 'git rebase --continue' to finalize the rebase.

I don't believe it.  "git branch" would have shown "* (no branch)" as 
current branch, unless the rebase is finalized.

git rebase -i works on a _detached_ HEAD, for two reasons:

- easier working with reflogs (as the branch's reflog shows before rebase 
and after rebase, but nothing in between), and

- to prevent exactly the scenario you are describing.

Ciao,
Dscho

```

## Steven Walter, 2008-02-02 16:25

Subject: Re: Strange behavior with git rebase (-i)
Message-ID: <20080202162524.GB25945@dervierte>
URL: https://gitlist.dev/e/20080202162524.GB25945%40dervierte
In-Reply-To: <alpine.LSU.1.00.0802021538300.7372@racer.site>

```
On Sat, Feb 02, 2008 at 03:42:06PM +0000, Johannes Schindelin wrote:
> I don't believe it.  "git branch" would have shown "* (no branch)" as 
> current branch, unless the rebase is finalized.
> 
> git rebase -i works on a _detached_ HEAD, for two reasons:

> On Sat, 2 Feb 2008, Stefan (metze) Metzmacher wrote:
> > I was using git 1.5.3.2

Did rebase -i in git 1.5.3.2 use a detached head?  I thought that was
new in 1.5.4.
-- 
-Steven Walter <stevenrwalter@gmail.com>
Freedom is the freedom to say that 2 + 2 = 4
B2F1 0ECC E605 7321 E818  7A65 FC81 9777 DC28 9E8F 

```

## Johannes Schindelin, 2008-02-02 17:08

Subject: Re: Strange behavior with git rebase (-i)
Message-ID: <alpine.LSU.1.00.0802021708030.7372@racer.site>
URL: https://gitlist.dev/e/alpine.LSU.1.00.0802021708030.7372%40racer.site
In-Reply-To: <20080202162524.GB25945@dervierte>

```
Hi,

On Sat, 2 Feb 2008, Steven Walter wrote:

> On Sat, Feb 02, 2008 at 03:42:06PM +0000, Johannes Schindelin wrote:
> > I don't believe it.  "git branch" would have shown "* (no branch)" as 
> > current branch, unless the rebase is finalized.
> > 
> > git rebase -i works on a _detached_ HEAD, for two reasons:
> 
> > On Sat, 2 Feb 2008, Stefan (metze) Metzmacher wrote:
> > > I was using git 1.5.3.2
> 
> Did rebase -i in git 1.5.3.2 use a detached head?  I thought that was
> new in 1.5.4.

rebase -i uses a detached HEAD since it was merged.  In 1.5.4, rebase 
(note the absence of -i) uses a detached HEAD, too.

Ciao,
Dscho

```

## Stefan (metze) Metzmacher, 2008-02-03 01:21

Subject: Re: Strange behavior with git rebase (-i)
Message-ID: <47A51708.4020406@samba.org>
URL: https://gitlist.dev/e/47A51708.4020406%40samba.org
In-Reply-To: <alpine.LSU.1.00.0802021708030.7372@racer.site>

```
Johannes Schindelin schrieb:
> Hi,
> 
> On Sat, 2 Feb 2008, Steven Walter wrote:
> 
>> On Sat, Feb 02, 2008 at 03:42:06PM +0000, Johannes Schindelin wrote:
>>> I don't believe it.  "git branch" would have shown "* (no branch)" as 
>>> current branch, unless the rebase is finalized.
>>>
>>> git rebase -i works on a _detached_ HEAD, for two reasons:
>>> On Sat, 2 Feb 2008, Stefan (metze) Metzmacher wrote:
>>>> I was using git 1.5.3.2
>> Did rebase -i in git 1.5.3.2 use a detached head?  I thought that was
>> new in 1.5.4.
> 
> rebase -i uses a detached HEAD since it was merged.  In 1.5.4, rebase 
> (note the absence of -i) uses a detached HEAD, too.

Hmm, I can't reproduce this...maybe I was just to stupid and didn't look
at the git branch output carefully...

metze


```
