git signoff+ and review+

David Disseldorp ddiss at
Tue Mar 24 11:51:46 UTC 2020


On Tue, 24 Mar 2020 11:00:11 +0100, Andreas Schneider via samba-technical wrote:

> Hello,
> as a daily task I have to sign commits and also add my review tag after 
> inspection.
> As git-filter-branch has been deprecated and the replacement is git-filter-
> repo [1], I've written some really nice python tools to make my life easier.
> In a git repository I and do:
> git signoff+            # Add my signoff to commits I authored.
> git signoff+ --by metze # Sign commits authored by metze,
>                         # because he forgot :-)
> git review+             # Add my RB tag to commits I'm not the
>                         # author of or which has my sign tag
> git review+ --by metze  # Add review by metze

These look helpful. Keep in mind that git comes with a built-in
interpret-trailers command, which is also pretty useful for this (and
handles duplicates, etc.). I have the following in my git config:

  # add a Reviewed-by: David Disseldorp <ddiss at> trailer to top commit msg
  rbm = "!f() { \
    t=\"Reviewed-by: $(git config --get <$(git config --get>\"; \
    GIT_EDITOR=\"git interpret-trailers --trailer \\\"$t\\\" --in-place\" git commit --amend; \
    }; f"

  # add a trailing Reviewed-by: $1 trailer to top commit msg
  rbo = "!f() { \
    t=\"Reviewed-by: $1\"; \
    GIT_EDITOR=\"git interpret-trailers --trailer \\\"$t\\\" --in-place\" git commit --amend; \
    }; f"

For batch reviewed-bys, I use "git rebase -i" and run "git rbm" via
execute hook.

Cheers, David

More information about the samba-technical mailing list