格式化git日志命令



可以运行一些命令并采取以下git日志消息

commit 55dbd23f3802527cef5f9d3d5ea4dd3c69c72c5a
Author: Example User
Date:   Thu Apr 20 15:40:15 2017 -0500
    Here is the short commit message line.
    Here is the long commit message.
    This message can span multiple lines or have line breaks.
    Some more information about this commit.

并像以下内容一样输出。

Here is the short commit message line.
    Here is the long commit message.
    This message can span multiple lines or have line breaks.
    Some more information about this commit.

所以,如果我有另一个遵循的提交只是一行提交消息,那么我希望输出看起来像。

Here is the short commit message line.
    Here is the long commit message.
    This message can span multiple lines or have line breaks.
    Some more information about this commit.
A different commit was made here. This only uses short message.

我只用git格式做的最好的就是:

git log --pretty="format:%s%w(0,8,8)%+b"

它放置了对象,然后将填充的身体放置。但是,据我了解,Git无法修改身体文本,因此身体内部的所有空白线都保持原样。因此,您可以将它们过滤出来,例如通过使用grep

git log --pretty="format:%s%w(0,8,8)%+b" | grep -v '^ *$'

用选项卡替换:

git log --pretty="format:%s%w(0,1,1)%+b" | grep -v '^ *$' | sed 's/^ /t/'

相关内容

  • 没有找到相关文章

最新更新