# Updating the commit message for reverts

8 messages from 2019-12-24 to 2019-12-30. Participants: Gal Paikin, Junio C Hamano, Danh Doan, Jonathan Nieder, Oswald Buddenhagen.
Thread: https://gitlist.dev/t/52514

## Gal Paikin, 2019-12-24 11:06

Subject: Updating the commit message for reverts
Message-ID: <CAEsQYpNtgMgwjVSOYB9vn-YPvKyKPZ2yZ3NigAVe3PztTN4v8w@mail.gmail.com>
URL: https://gitlist.dev/e/CAEsQYpNtgMgwjVSOYB9vn-YPvKyKPZ2yZ3NigAVe3PztTN4v8w%40mail.gmail.com

```
Hi,

I work on the Gerrit team and I would like to change the default
behavior for suggested commit messages for Reverts.
Currently, if the user is trying a change called '"Revert "change X"',
the suggested commit message would be 'Revert "Revert "Change X""'
which is silly, since sometimes users want to revert the same change
many times.

The suggestion is to change the behavior to "Revert^N" instead of
multiple Reverts one after another.

I'm happy to change those things in Gerrit, but it would also be nice
if it were changed inside of Git.

What do you think?

Thanks!
Gal Paikin

```

## Junio C Hamano, 2019-12-24 19:15

Subject: Re: Updating the commit message for reverts
Message-ID: <xmqq7e2l5ych.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqq7e2l5ych.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <CAEsQYpNtgMgwjVSOYB9vn-YPvKyKPZ2yZ3NigAVe3PztTN4v8w@mail.gmail.com>

```
Gal Paikin <paiking@google.com> writes:

> I work on the Gerrit team and I would like to change the default
> behavior for suggested commit messages for Reverts.
> Currently, if the user is trying a change called '"Revert "change X"',
> the suggested commit message would be 'Revert "Revert "Change X""'
> which is silly, since sometimes users want to revert the same change
> many times.
>
> The suggestion is to change the behavior to "Revert^N" instead of
> multiple Reverts one after another.
>
> I'm happy to change those things in Gerrit, but it would also be nice
> if it were changed inside of Git.
>
> What do you think?

I do not _think_ anybody lets the exact phrase 'Revert ...' in the
log message to be read by scripts to perform machannical action, so
in that sense it may be OK to special-case the reversion of a revert
and rephrase it in a more human friendly way.

BUT

 * what does "Revert^47" even mean?  Not just the proposed phrasing
   looks horrible, it is not even clear what happened at the end.
   Was the patch turned out to be OK after all these reversion war,
   or got rejected for now?  It also misleads readers who know Git
   can perform a merge with more than two parents that it may be
   reverting the effect relative to 47th parent of the commit.

   It _might_ be slightly more acceptable to flip the phrase between
   "Revert X" and "Reinstate X" (or "Reapply X"), without saying
   "this is the 47th round of our reversion war".  I dunno.

 * how often does it happen in practice?  If a group of developers
   find themselves reverting and reapplying the same commit more
   than a few times, wouldn't they rather stop and think before
   doing yet another round, which I expect to result in a better fix
   implemented as a separate and brand new patch that takes
   inspiration from a patch that was earlier reverted, and at that
   point it won't be the 47th iteration of reversion war anyway.

So, I am fairly negative on the change in the proposed form as-is.

```

## Gal Paikin, 2019-12-27 10:13

Subject: Re: Updating the commit message for reverts
Message-ID: <CAEsQYpMJGbw3L66vCd25Ht0bTBzvvt1yMRd2U3=u3U-BZukyzg@mail.gmail.com>
URL: https://gitlist.dev/e/CAEsQYpMJGbw3L66vCd25Ht0bTBzvvt1yMRd2U3%3Du3U-BZukyzg%40mail.gmail.com
In-Reply-To: <xmqq7e2l5ych.fsf@gitster-ct.c.googlers.com>

```
Hi,
Thanks for the reply!

So the idea of changing from "Revert Revert" to "Reland", "reapply"
has a big problem: sometimes Revert^2 actually means 'reverting
"Revert"' since "Revert" introduced a bug that wasn't in the original
change.

So to your question, I don't know what Revert^47 means since it
depends on each individual case. Sometimes it actually means "Revert"
and sometimes it means "Reland".

So do people actually use it? Yes! Many users reported to me that it
is not that unusual to get to "Revert^6", and it is very usual and
common to get to "Revert^2/3/4". It is also useful for the users to
know the number of the revert, according to the reports. Here is an
example:
https://android-review.googlesource.com/c/platform/art/+/352330
Feel free to also search for "Revert^2/3/4" to find many results.

Anyway, I am certain that "Revert^3" is better than "Revert revert
revert". There is definitely no clear way to solve this issue, but
perhaps "nth revert" would be a more "human language" solution?

Best,
Gal


On Tue, Dec 24, 2019 at 8:15 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Gal Paikin <paiking@google.com> writes:
>
> > I work on the Gerrit team and I would like to change the default
> > behavior for suggested commit messages for Reverts.
> > Currently, if the user is trying a change called '"Revert "change X"',
> > the suggested commit message would be 'Revert "Revert "Change X""'
> > which is silly, since sometimes users want to revert the same change
> > many times.
> >
> > The suggestion is to change the behavior to "Revert^N" instead of
> > multiple Reverts one after another.
> >
> > I'm happy to change those things in Gerrit, but it would also be nice
> > if it were changed inside of Git.
> >
> > What do you think?
>
> I do not _think_ anybody lets the exact phrase 'Revert ...' in the
> log message to be read by scripts to perform machannical action, so
> in that sense it may be OK to special-case the reversion of a revert
> and rephrase it in a more human friendly way.
>
> BUT
>
>  * what does "Revert^47" even mean?  Not just the proposed phrasing
>    looks horrible, it is not even clear what happened at the end.
>    Was the patch turned out to be OK after all these reversion war,
>    or got rejected for now?  It also misleads readers who know Git
>    can perform a merge with more than two parents that it may be
>    reverting the effect relative to 47th parent of the commit.
>
>    It _might_ be slightly more acceptable to flip the phrase between
>    "Revert X" and "Reinstate X" (or "Reapply X"), without saying
>    "this is the 47th round of our reversion war".  I dunno.
>
>  * how often does it happen in practice?  If a group of developers
>    find themselves reverting and reapplying the same commit more
>    than a few times, wouldn't they rather stop and think before
>    doing yet another round, which I expect to result in a better fix
>    implemented as a separate and brand new patch that takes
>    inspiration from a patch that was earlier reverted, and at that
>    point it won't be the 47th iteration of reversion war anyway.
>
> So, I am fairly negative on the change in the proposed form as-is.

```

## Danh Doan, 2019-12-28 13:20

Subject: Re: Updating the commit message for reverts
Message-ID: <20191228132022.GD24268@danh.dev>
URL: https://gitlist.dev/e/20191228132022.GD24268%40danh.dev
In-Reply-To: <CAEsQYpMJGbw3L66vCd25Ht0bTBzvvt1yMRd2U3=u3U-BZukyzg@mail.gmail.com>

```
On 2019-12-27 11:13:47+0100, Gal Paikin <paiking@google.com> wrote:
> Hi,
> Thanks for the reply!
> 
> So the idea of changing from "Revert Revert" to "Reland", "reapply"
> has a big problem: sometimes Revert^2 actually means 'reverting
> "Revert"' since "Revert" introduced a bug that wasn't in the original
> change.
> 
> So to your question, I don't know what Revert^47 means since it
> depends on each individual case. Sometimes it actually means "Revert"
> and sometimes it means "Reland".
> 
> So do people actually use it? Yes! Many users reported to me that it
> is not that unusual to get to "Revert^6", and it is very usual and

I've seen Revert x6 in a code base, I couldn't get to know the reason
for that reversion war. I think it could be seen more in some in-house
web development that uses trunk-based development, code is being
tested with CI/CD, lightly tested, squash-merged to master,
then run into problem in staging (or worst, production, because not
enough traffix was generated for testing environment).

> common to get to "Revert^2/3/4". It is also useful for the users to
> know the number of the revert, according to the reports. Here is an
> example:
> https://android-review.googlesource.com/c/platform/art/+/352330
> Feel free to also search for "Revert^2/3/4" to find many results.
> 
> Anyway, I am certain that "Revert^3" is better than "Revert revert
> revert". There is definitely no clear way to solve this issue, but
> perhaps "nth revert" would be a more "human language" solution?

In my very personal opinion, "nth revert" is a poor choice.
At a first glance, I would take it as:

	This is the "nth revert", after applying this patch n times.

-- 
Danh

```

## Junio C Hamano, 2019-12-30 16:52

Subject: Re: Updating the commit message for reverts
Message-ID: <xmqqwoadhi2m.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqwoadhi2m.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <CAEsQYpMJGbw3L66vCd25Ht0bTBzvvt1yMRd2U3=u3U-BZukyzg@mail.gmail.com>

```
Gal Paikin <paiking@google.com> writes:

> So the idea of changing from "Revert Revert" to "Reland", "reapply"
> has a big problem: sometimes Revert^2 actually means 'reverting
> "Revert"' since "Revert" introduced a bug that wasn't in the original
> change.

Sorry, I do not see a relevance of the above in this discussion, as
the situation does not improve if you phrase it as "Revert^2" or
"Second Revert".

Also as somebody else said in downthread, the phrasing "second
revert" would typically mean "a patch gets applied, proves to be
premature and gets reverted, the revert is reverted because the
situation in the rest of the system improved to make the orignal
patch viable, and then gets reverted again due to some other
issues", i.e. "Revert Revert Revert do something", so it is even
worse.


```

## Jonathan Nieder, 2019-12-30 19:55

Subject: Re: Updating the commit message for reverts
Message-ID: <20191230195505.GD57251@google.com>
URL: https://gitlist.dev/e/20191230195505.GD57251%40google.com
In-Reply-To: <CAEsQYpNtgMgwjVSOYB9vn-YPvKyKPZ2yZ3NigAVe3PztTN4v8w@mail.gmail.com>

```
(also cc-ing the Gerrit list. The git mailing list requires plain-text
 email and prefers bottom-posting; there shouldn't be any other
 gotchas if you reply-all)
Hi Gal,

Gal Paikin wrote:

> I work on the Gerrit team and I would like to change the default
> behavior for suggested commit messages for Reverts.

Thanks for writing.  I like it when tools behave consistently with one
another, so I'm glad you brought it up here.

> Currently, if the user is trying a change called '"Revert "change X"',
> the suggested commit message would be 'Revert "Revert "Change X""'
> which is silly, since sometimes users want to revert the same change
> many times.

For context, [1] is where this was discussed previously on the Gerrit
mailing list.  Do you have more context?  For example, have there been
reports from users requesting this kind of change?

For a bit of precedent, the Chromium project has some custom logic[2]
that rewrites a revert of a revert to "Reland".  I kind of like that,
since it makes the intention behind the revert-of-revert a little
clearer.

If both reverts are clean, then the typical use case I can think of is
that a prerequisite was missing, hence the revert; after all the
prerequisites were in place, it was then safe to roll forward, hence
the reland.  I would hope that the full commit messages for these
revert commits would provide this context since without that kind of
communication from the people involved, a reader is lost.

> The suggestion is to change the behavior to "Revert^N" instead of
> multiple Reverts one after another.

This would be replacing one kind of jargon with another, so it's not
clear to me that it would improve matters.

With Revert / Reland, we can forget the N altogether:

 1. 'Do some great thing'
 2. 'Revert "Do some great thing"'
 3. 'Reland "Do some great thing"'
 4. 'Revert "Do some great thing"'
 5. (etc)

For the reader of the shortlog, it's not too important how long the
edit war has gone.  The single word makes it clear what the commit
is going to do.

In the full commit message, I would hope that people put in some
explanation of the story so far to explain why they have gone
back-and-forth all these times.

Thanks and hope that helps,
Jonathan

[1] https://groups.google.com/d/msg/repo-discuss/edl43LcyEKE/f9Q65kOcBgAJ
[2] https://chromium-review.googlesource.com/c/infra/gerrit-plugins/chromium-behavior/+/757684

```

## Jonathan Nieder, 2019-12-30 19:59

Subject: Re: Updating the commit message for reverts
Message-ID: <20191230195915.GE57251@google.com>
URL: https://gitlist.dev/e/20191230195915.GE57251%40google.com
In-Reply-To: <CAEsQYpNtgMgwjVSOYB9vn-YPvKyKPZ2yZ3NigAVe3PztTN4v8w@mail.gmail.com>

```
(not cc-ing the Gerrit list after all, since only members can post)
Hi Gal,

Gal Paikin wrote:

> I work on the Gerrit team and I would like to change the default
> behavior for suggested commit messages for Reverts.

Thanks for writing.  I like it when tools behave consistently with one
another, so I'm glad you brought it up here.

> Currently, if the user is trying a change called '"Revert "change X"',
> the suggested commit message would be 'Revert "Revert "Change X""'
> which is silly, since sometimes users want to revert the same change
> many times.

For context, [1] is where this was discussed previously on the Gerrit
mailing list.  Do you have more context?  For example, have there been
reports from users requesting this kind of change?

For a bit of precedent, the Chromium project has some custom logic[2]
that rewrites a revert of a revert to "Reland".  I kind of like that,
since it makes the intention behind the revert-of-revert a little
clearer.

If both reverts are clean, then the typical use case I can think of is
that a prerequisite was missing, hence the revert; after all the
prerequisites were in place, it was then safe to roll forward, hence
the reland.  I would hope that the full commit messages for these
revert commits would provide this context since without that kind of
communication from the people involved, a reader is lost.

> The suggestion is to change the behavior to "Revert^N" instead of
> multiple Reverts one after another.

This would be replacing one kind of jargon with another, so it's not
clear to me that it would improve matters.

With Revert / Reland, we can forget the N altogether:

 1. 'Do some great thing'
 2. 'Revert "Do some great thing"'
 3. 'Reland "Do some great thing"'
 4. 'Revert "Do some great thing"'
 5. (etc)

For the reader of the shortlog, it's not too important how long the
edit war has gone.  The single word makes it clear what the commit
is going to do.

In the full commit message, I would hope that people put in some
explanation of the story so far to explain why they have gone
back-and-forth all these times.

Thanks and hope that helps,
Jonathan

[1] https://groups.google.com/d/msg/repo-discuss/edl43LcyEKE/f9Q65kOcBgAJ
[2] https://chromium-review.googlesource.com/c/infra/gerrit-plugins/chromium-behavior/+/757684

```

## Oswald Buddenhagen, 2019-12-30 20:33

Subject: Re: Updating the commit message for reverts
Message-ID: <20191230203348.GA831634@ugly>
URL: https://gitlist.dev/e/20191230203348.GA831634%40ugly
In-Reply-To: <20191230195915.GE57251@google.com>

```
On Mon, Dec 30, 2019 at 11:59:15AM -0800, Jonathan Nieder wrote:
>Gal Paikin wrote:
>> The suggestion is to change the behavior to "Revert^N" instead of
>> multiple Reverts one after another.
>
>This would be replacing one kind of jargon with another, so it's not
>clear to me that it would improve matters.
>
>With Revert / Reland, we can forget the N altogether: [...]
>
the irony here is that "reland" is of course yet more jargon. :-D
i'd strongly suggest to use something that actually appears in standard 
dictionaries, preferentially "reapply".

> 1. 'Do some great thing'
> 2. 'Revert "Do some great thing"'
> 3. 'Reland "Do some great thing"'
> 4. 'Revert "Do some great thing"'
> 5. (etc)
>
>For the reader of the shortlog, it's not too important how long the
>edit war has gone.  The single word makes it clear what the commit
>is going to do.
>
in principle i agree, but it irks me somewhat that the summaries become 
non-unique, as that always somewhat impacts history browsing.

```
