Is there a way to list the commit's author in `git rebase -i` (interactive)?
GitGit RebaseGit Problem Overview
When I do a git rebase -i
on a branch shared with a co-worker, I often want to just rebase my own commits. However, because the interactive rebase tool doesn't add the author information to the rebasing file (all t gives is the commit hash and description), I wind up having to go check commits in another tab to see if they are mine or not.
Is there any way to give git rebase -i
a --format
flag (or something like it), to make it include the author?
Git Solutions
Solution 1 - Git
As of git 2.6, git rebase -i
uses rebase.instructionFormat
(default %s
) to generate the text after pick NNNNN...
.
Since this is a git-config
item, you can set the value per repository, for yourself in general, or even using the -c
option on a one-time basis.
EDIT:
As jdknight suggested in the comments, the specific command for this would be:
git config --add rebase.instructionFormat "(%an <%ae>) %s"
or, to avoid item repetition, as oalders suggested, you can instead set the config globally:
git config --global rebase.instructionFormat "(%an <%ae>) %s"
Solution 2 - Git
git -c "rebase.instructionFormat=(%an <%ae>) %s" rebase -i COMMIT_HASH
Interactive output is going to look as follows:
pick b596a7b (Nik Sumeiko <email@example.com>) Refactors type checking utilities
pick c8b815f (Attila Kerekes <email@example.com>) Implements commit message linting
Solution 3 - Git
Edit your .gitconfig
to add:
[rebase]
instructionFormat = %s [%an]
That will show the short commit message and then the author name in square brackets.