gitgit-rebase

Is there a way to list the commit's author in `git rebase -i` (interactive)?


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?


Solution

  • As of git 2.6, git rebase -i uses rebase.instructionFormat (default %s) to generate the text after pick NNNNN....

    Quoting the documentation:

    rebase.instructionFormat

    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"