2017-04-21 11 views
1

ですいくつかのコマンドを実行して、次のようフォーマットはgit logコマンド

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. 

と出力し、次のgitのログメッセージを取ることが可能です。

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. 

したがって、私はそれに続くコミットが1行コミットメッセージである場合、出力を見たいと思います。

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. 

答えて

1

私は一人で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のログ--all --after = "$のDATE午後12時" --beforeに取り組んできた鉱山と組み合わせる

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

を= "$ DATE 23:59" --author = "FatGuyLaughing" --format =%B | sed '/^$/d''はそのトリックを行うべきです。ありがとうございました! – FatGuyLaughing

+0

長いメッセージを8文字のスペースではなくタブ文字で始める方法はありますか? – FatGuyLaughing

+0

もっと具体的には、そのコマンドを受け取り、stdoutにタブ文字を理解させる方法がありますか? – FatGuyLaughing

関連する問題