Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Press "h" in a Magit interactive rebase to change the commit author of some commits. Username completion is provided by the git shortlog.
(defun dm/change-commit-author (arg)
"Change the commit author during an interactive rebase in Magit.
With a prefix argument, insert a new change commit author command
even when there is already another rebase command on the current
line. With empty input, remove the change commit author action
on the current line, if any."
(interactive "P")
(let ((author
(magit-transient-read-person "Select a new author for this commit"
(lambda (_) (if author
(format "git commit --amend --author='%s'" author)
(define-key git-rebase-mode-map (kbd "h") #'dm/change-commit-author)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment