git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Updating the commit message for reverts

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Dec 30, 2019, 19:55 UTC
Message-ID
<20191230195505.GD57251@google.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

Previous: Junio C HamanoNext: Jonathan Nieder
Message 6 of 8 in “Updating the commit message for reverts”
  1. Gal PaikinDec 24, 2019
  2. Junio C HamanoDec 24, 2019
  3. Gal PaikinDec 27, 2019
  4. Danh DoanDec 28, 2019
  5. Junio C HamanoDec 30, 2019
  6. Jonathan NiederDec 30, 2019
  7. Jonathan NiederDec 30, 2019
  8. Oswald BuddenhagenDec 30, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.