# [BUG] git rebase is confuse if conflict resolution doesn't produce diff

4 messages from 2008-08-15 to 2008-08-18. Participants: Guillaume Desmottes, Stephan Beyer, Junio C Hamano.
Thread: https://gitlist.dev/t/15026

## Guillaume Desmottes, 2008-08-15 17:00

Subject: [BUG] git rebase is confuse if conflict resolution doesn't produce diff
Message-ID: <1218819643.6345.57.camel@cass-lpt>
URL: https://gitlist.dev/e/1218819643.6345.57.camel%40cass-lpt

```
To reproduce:
- Rebase a branch "foo" on a branch "bar" in a way that there is a
conflict that you have to manually resolve.
- Run git diff and see the conflict
- Edit the conflicted file and remove all the conflicting bits (that
could be a valid resolution of the conflict)
- Now git diff produces an empty diff
- git add $CONFLICTED_FILE  as you have resolve the conflict
- git rebase --continue

You get the following error:
No changes - did you forget to use 'git add'?

git status is empty as the conflict was resolved.

A simple workaround is to add a dummy blank line in the conflicted file
so the diff is not empty.


	G.

```

## Stephan Beyer, 2008-08-15 18:24

Subject: Re: [BUG] git rebase is confuse if conflict resolution doesn't produce diff
Message-ID: <20080815182439.GB23326@leksak.fem-net>
URL: https://gitlist.dev/e/20080815182439.GB23326%40leksak.fem-net
In-Reply-To: <1218819643.6345.57.camel@cass-lpt>

```
Hi,

Guillaume Desmottes wrote:
> To reproduce:
> - Rebase a branch "foo" on a branch "bar" in a way that there is a
> conflict that you have to manually resolve.
> - Run git diff and see the conflict
> - Edit the conflicted file and remove all the conflicting bits (that
> could be a valid resolution of the conflict)
> - Now git diff produces an empty diff
> - git add $CONFLICTED_FILE  as you have resolve the conflict
> - git rebase --continue
> 
> You get the following error:
> No changes - did you forget to use 'git add'?
> 
> git status is empty as the conflict was resolved.
> 
> A simple workaround is to add a dummy blank line in the conflicted file
> so the diff is not empty.

I think this is no bug, since you would generate an empty commit, i.e
a commit with no changes at all. Usually you do not want such commits.
So git rebase --skip is perhaps what you want.

Regards,
  Stephan

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

```

## Junio C Hamano, 2008-08-15 18:41

Subject: Re: [BUG] git rebase is confuse if conflict resolution doesn't produce diff
Message-ID: <7vzlne9l49.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vzlne9l49.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <1218819643.6345.57.camel@cass-lpt>

```
Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> writes:

> To reproduce:
> - Rebase a branch "foo" on a branch "bar" in a way that there is a
> conflict that you have to manually resolve.
> - Run git diff and see the conflict
> - Edit the conflicted file and remove all the conflicting bits (that
> could be a valid resolution of the conflict)
> - Now git diff produces an empty diff
> - git add $CONFLICTED_FILE  as you have resolve the conflict
> - git rebase --continue

I think you would need a bit more than that to trigger this "behaviour".
Your resolution needs to be such that it is identical to the HEAD where
the rebased change is applied to, iow, among the series of commits, the
final effect chosen by you from this particular one is not to do
anything.  So, not just "Now git diff produces an empty diff" in the above
sequence, which merely means that the three-way --cc diff between the
conflicted parties are resolved by taking from one side, after that "git
add", "git diff HEAD" will have to be empty, for you to see the message.

In essence, the final effect chosen by you is to skip this commit.  You
might want to say "git rebase --skip" here if that is the case.

```

## Guillaume Desmottes, 2008-08-18 09:10

Subject: Re: [BUG] git rebase is confuse if conflict resolution doesn't produce diff
Message-ID: <1219050656.20418.3.camel@cass-lpt>
URL: https://gitlist.dev/e/1219050656.20418.3.camel%40cass-lpt
In-Reply-To: <20080815182439.GB23326@leksak.fem-net>

```
Le vendredi 15 août 2008 à 20:24 +0200, Stephan Beyer a écrit :
> Hi,
> 
> Guillaume Desmottes wrote:
> > To reproduce:
> > - Rebase a branch "foo" on a branch "bar" in a way that there is a
> > conflict that you have to manually resolve.
> > - Run git diff and see the conflict
> > - Edit the conflicted file and remove all the conflicting bits (that
> > could be a valid resolution of the conflict)
> > - Now git diff produces an empty diff
> > - git add $CONFLICTED_FILE  as you have resolve the conflict
> > - git rebase --continue
> > 
> > You get the following error:
> > No changes - did you forget to use 'git add'?
> > 
> > git status is empty as the conflict was resolved.
> > 
> > A simple workaround is to add a dummy blank line in the conflicted file
> > so the diff is not empty.
> 
> I think this is no bug, since you would generate an empty commit, i.e
> a commit with no changes at all. Usually you do not want such commits.
> So git rebase --skip is perhaps what you want.

Yeah, I know, that's what I did when I finally understood the problem.
But that took me more than 20 minutes before understanding what I did
wrong (I just manually resolved the conflict and wasn't aware that what
I actually wanted was to remove the commit).

Maybe in that case git rebase should suggest something like that "Seems
you want to skip this commit. Do you want to --skip it ?".


	G.

```
