git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Non-interactively rewording commit messages
Date: Thu, 30 Jun 2022 21:01:33 -0700	[thread overview]
Message-ID: <CABPp-BHX5H1co+cMS2LEt=NYB5==5e4YK_sK=h_O1-zxaNocAA@mail.gmail.com> (raw)
In-Reply-To: <20220630152757.yxwhijvj5xoosrws@meerkat.local>

On Thu, Jun 30, 2022 at 8:35 AM Konstantin Ryabitsev
<konstantin@linuxfoundation.org> wrote:
>
> Hello, all:
>
> What's the best approach to non-interactively rewrite specific commit
> messages? In this particular case, I am trying to automatically retrieve code
> review trailers sent to the mailing list and put them into corresponding
> commits.
>
> For example, I have a set of commits:
>
> abcabc: This commit does foo
> bcdbcd: This commit does bar
> cdecde: This commit does baz
>
> They were all sent to the mailing list and a maintainer sent a "Reviewed-by"
> to the second commit. In a usual interactive rebase session this would be:
>
> pick abcabc
> reword bcdbcd
> pick cdecde
>
> When the edit screen comes up for the bcdbcd commit, the author would manually
> stick the new trailer into the commit message. However, I can automate all
> that away with b4 -- just need a sane strategy for non-interactively rewriting
> entire commit messages at arbitrary points in the recent history.
>
> Any pointers?

One possibility would be to tweak
https://github.com/newren/git-filter-repo/blob/main/contrib/filter-repo-demos/signed-off-by,
modifying the line setting the 'trailer' variable to make it be a
Reviewed-by rather than a Signed-off-by.  You could tweak the script
to also make other automated commit message changes unrelated to any
trailers, if you wanted.

(There's also the slightly less careful way of adding trailers shown
over at https://github.com/newren/git-filter-repo/blob/main/Documentation/converting-from-filter-branch.md#rewriting-commit-messages----adding-text,
but the literal appending instead of determining whether to also first
add one or more newlines before the trailer might not be exactly what
you want.)

  parent reply	other threads:[~2022-07-01  4:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 15:27 Non-interactively rewording commit messages Konstantin Ryabitsev
2022-06-30 17:32 ` Carlo Marcelo Arenas Belón
2022-06-30 17:34 ` Christian Couder
2022-06-30 17:54   ` Konstantin Ryabitsev
2022-06-30 18:10     ` Ævar Arnfjörð Bjarmason
2022-06-30 21:35   ` Junio C Hamano
2022-07-01 11:10     ` Christian Couder
2022-06-30 21:17 ` brian m. carlson
2022-07-01  4:01 ` Elijah Newren [this message]
2022-07-01 18:18   ` Konstantin Ryabitsev
2022-07-01 13:37 ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABPp-BHX5H1co+cMS2LEt=NYB5==5e4YK_sK=h_O1-zxaNocAA@mail.gmail.com' \
    --to=newren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=konstantin@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).