Reputation: 35790
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?
Upvotes: 71
Views: 7695
Reputation: 488113
As of git 2.6, git rebase -i
uses rebase.instructionFormat
(default %s
) to generate the text after pick NNNNN...
.
Quoting the documentation:
A format string, as specified in git-log, to be used for the todo list during an interactive rebase. The format will automatically have the commit hash prepended to the format.
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.
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"
Upvotes: 75
Reputation: 8723
git -c "rebase.instructionFormat=(%an <%ae>) %s" rebase -i COMMIT_HASH
Interactive output is going to look as follows:
pick b596a7b (Nik Sumeiko <[email protected]>) Refactors type checking utilities
pick c8b815f (Attila Kerekes <[email protected]>) Implements commit message linting
Upvotes: 20
Reputation: 6105
Edit your .gitconfig
to add:
[rebase]
instructionFormat = %s [%an]
That will show the short commit message and then the author name in square brackets.
Upvotes: 11