有没有办法在`git rebase -i`(交互式)中列出提交的作者?

mac*_*ost 29 git git-rebase

当我git rebase -i在与同事共享的分支上执行操作时,我经常想要自己修改自己的提交.但是,因为交互式rebase工具不会将作者信息添加到rebasing文件(所有t给出的是提交哈希和描述),所以我最终必须检查另一个选项卡中的提交以查看它们是否是我的.

有没有办法给git rebase -i一个--format旗帜(或类似的东西),让它包括作者?

tor*_*rek 24

从git 2.6开始,git rebase -i使用rebase.instructionFormat(默认%s)生成文本pick NNNNN....

由于这是一个git-config项目,您可以为自己设置每个存储库的值,或者甚至-c一次性使用该选项.

  • `git config --add rebase.instructionFormat"(%an <%ae>)%s"`(对于懒惰) (23认同)

Nik*_*iko 12

git -c "rebase.instructionFormat=(%an <%ae>) %s" rebase -i COMMIT_HASH
Run Code Online (Sandbox Code Playgroud)

交互式输出看起来如下:

pick b596a7b (Nik Sumeiko <email@example.com>) Refactors type checking utilities
pick c8b815f (Attila Kerekes <email@example.com>) Implements commit message linting
Run Code Online (Sandbox Code Playgroud)

  • 只复制/粘贴SODD(堆栈溢出驱动开发) (4认同)

Bra*_*rad 11

编辑你.gitconfig要添加:

[rebase]
    instructionFormat = %s [%an]
Run Code Online (Sandbox Code Playgroud)

这将显示简短的提交消息,然后在方括号中显示作者姓名.