# Bug: Revert with -m 0 says no -m was given

4 messages from 2017-03-23 to 2017-03-23. Participants: Ulrik Sverdrup, Junio C Hamano, Ævar Arnfjörð Bjarmason.
Thread: https://gitlist.dev/t/45484

## Ulrik Sverdrup, 2017-03-23 17:17

Subject: Bug: Revert with -m 0 says no -m was given
Message-ID: <12e6fae3-a341-3dcd-0920-c3df2d54d0a8@gmail.com>
URL: https://gitlist.dev/e/12e6fae3-a341-3dcd-0920-c3df2d54d0a8%40gmail.com

```
Hi,

Git produces a misleading error when you tell it `git revert -m 0`. The
user error is that the parent should be greater than zero, but git
doesn't help you. (I forgot that the first parent is 1 and not 0.)

$ git revert -m 0 abc
error: commit abc... is a merge but no -m option was given.
fatal: revert failed

Git already handles too large m correctly:

$ git revert -m 3 abc
error: commit abc... does not have parent 3
fatal: revert failed

-Ulrik

```

## Junio C Hamano, 2017-03-23 18:15

Subject: Re: Bug: Revert with -m 0 says no -m was given
Message-ID: <xmqq4lyjeu5m.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq4lyjeu5m.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <12e6fae3-a341-3dcd-0920-c3df2d54d0a8@gmail.com>

```
Ulrik Sverdrup <ulrik.sverdrup@gmail.com> writes:

> Git produces a misleading error when you tell it `git revert -m 0`.

Thanks.  

I think this is the same issue as the one with 'cherry-pick' that
was reported earlier.  We have a fix in the 'master' branch already;
please try it out.




```

## Ævar Arnfjörð Bjarmason, 2017-03-23 20:39

Subject: Re: Bug: Revert with -m 0 says no -m was given
Message-ID: <CACBZZX5e-p4gKSWxehhVnnSgApC9H2v_ud+1Drz-vu_OAZwCgg@mail.gmail.com>
URL: https://gitlist.dev/e/CACBZZX5e-p4gKSWxehhVnnSgApC9H2v_ud%2B1Drz-vu_OAZwCgg%40mail.gmail.com
In-Reply-To: <xmqq4lyjeu5m.fsf@gitster.mtv.corp.google.com>

```
On Thu, Mar 23, 2017 at 7:15 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Ulrik Sverdrup <ulrik.sverdrup@gmail.com> writes:
>
>> Git produces a misleading error when you tell it `git revert -m 0`.
>
> Thanks.
>
> I think this is the same issue as the one with 'cherry-pick' that
> was reported earlier.  We have a fix in the 'master' branch already;
> please try it out.

Specifically, in master:

$ ./git revert afd6726309
error: commit afd6726309f57f532b4b989a75c1392359c611cc is a merge but
no -m option was given.
fatal: revert failed
$ ./git revert -m 0 afd6726309
error: option `mainline' expects a number greater than zero

```

## Junio C Hamano, 2017-03-23 21:38

Subject: Re: Bug: Revert with -m 0 says no -m was given
Message-ID: <xmqqmvcbad1q.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqmvcbad1q.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <CACBZZX5e-p4gKSWxehhVnnSgApC9H2v_ud+1Drz-vu_OAZwCgg@mail.gmail.com>

```
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> On Thu, Mar 23, 2017 at 7:15 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Ulrik Sverdrup <ulrik.sverdrup@gmail.com> writes:
>>
>>> Git produces a misleading error when you tell it `git revert -m 0`.
>>
>> Thanks.
>>
>> I think this is the same issue as the one with 'cherry-pick' that
>> was reported earlier.  We have a fix in the 'master' branch already;
>> please try it out.
>
> Specifically, in master:
>
> $ ./git revert afd6726309
> error: commit afd6726309f57f532b4b989a75c1392359c611cc is a merge but
> no -m option was given.
> fatal: revert failed
> $ ./git revert -m 0 afd6726309
> error: option `mainline' expects a number greater than zero

Yes, exactly.

Thanks.

```
