[RFC PATCH 0/2] rebase: support --trailer and add --reviewby
From: Li Chen <hidden>
Date: 2025-05-06 12:57:24
From: Li Chen <redacted>
This patch series enhances `git rebase` and `git am` by introducing three features:
1. `--trailer <line>` support on rebase's merge backend
Allows arbitrary trailer lines (e.g. multiple “Reviewed-by: …”) to be appended
to each rebased commit. The apply backend (`git am`) is explicitly
rejected when used with `--trailer`, since it has no message‑filter/trailer support.
This is especially useful when reviewee add reviewer's Reviewed-by, e.g.,
git rebase \
--trailer "Reviewed-by: Bob [off-list ref]" \
--trailer "Tested-by: Dana [off-list ref]" \
base~1
2. `--reviewby` shortcut flag for rebase
A convenience alias for adding a single “Reviewed‑by:” trailer using your configured
committer identity (user.name/user.email), analogous to --signoff. It works on both
rebase backends (merge and apply) and automatically disables fast‑forwarding to
rewrite commits.
This is especially useful when reviewer adds his/her Reviewed-by for a given patchset
which is already applied, e.g., git rebase --reviewby base~1
3. BTW, `--reviewby` shortcut flag is also added for `am` cmd, because it's needed
by rebase's apply backend.
I’ve run make test locally without failures. There are Github CI errors around leak checks that I’m still tracking down (see https://github.com/FirstLoveLife/git/actions/runs/14859027869).
Looking forward to your feedback!
Li Chen (2):
rebase, am: add --reviewby option
rebase: support --trailer
Documentation/git-am.adoc | 6 +-
builtin/am.c | 31 +++++++++
builtin/rebase.c | 84 ++++++++++++++++++++++
builtin/revert.c | 4 +-
sequencer.c | 100 ++++++++++++++++++++++++++-
sequencer.h | 12 ++++
t/meson.build | 2 +
t/t3439-rebase-reviewby.sh | 138 +++++++++++++++++++++++++++++++++++++
t/t3440-rebase-trailer.sh | 108 +++++++++++++++++++++++++++++
t/t4150-am.sh | 75 ++++++++++++++++++++
10 files changed, 556 insertions(+), 4 deletions(-)
create mode 100755 t/t3439-rebase-reviewby.sh
create mode 100755 t/t3440-rebase-trailer.sh
--
2.49.0