Git:git logコマンドで特定ユーザー(author, committer)のコミットのみを表示する方法

スポンサーリンク

git logコマンドで特定ユーザー(author, committer)のコミットのみを表示する方法

git logコマンドで特定ユーザー(author, committer)のコミットのみを表示するには--authorオプションまたは--committerオプションを指定します。

 

オプションの説明

 --author=<pattern>, --committer=<pattern>
     Limit the commits output to ones with author/committer header lines that match the specified pattern (regular expression). With more than one
     --author=<pattern>, commits whose author matches any of the given patterns are chosen (similarly for multiple --committer=<pattern>).

 

--authorオプションを指定した場合(--prettyは出力フォーマット、-nは出力コミット数を指定するオプション)

$ git log --author=Linus --pretty=short -n 3
commit acdd37769de8b0fe37a74bfc0475b63bdc55e9dc
Author: Linus Torvalds <torvalds@linux-foundation.org>

    Add 'human' date format

commit fd1062e52e1a7ed3be443a320708ed849958c1bf
Author: Linus Torvalds <torvalds@linux-foundation.org>

    mailinfo: fix in-body header continuations

commit 859b7f1d0e742493d2a9396794cd9040213ad846
Author: Linus Torvalds <torvalds@linux-foundation.org>

    pathspec: don't error out on all-exclusionary pathspec patterns

 

--commiterオプションを指定した場合(authorとcommitterが違う場合に使える)

$ git log --committer=Linus --pretty=full -n 1
commit 204ce979a5ed6f182e56bea5282c7b4a2d91208a
Author: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Commit: Linus Torvalds <torvalds@linux-foundation.org>

    Also use unpack_trees() in do_diff_cache()

    As in run_diff_index(), we call unpack_trees() with the oneway_diff()
    function in do_diff_cache() now.  This makes the function diff_cache()
    obsolete.

    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>