LoginSignup
4
4

More than 3 years have passed since last update.

自分のcommit logだけを見たい!author,committerの違いとは。

Last updated at Posted at 2019-09-12

チームで開発しているレポジトリの場合、自分もしくは他の誰かがコミットした情報のみをまとめて確認したいというケースが稀にある。

$ git log --author=[user_name]

もしくは

$ git log --committer=[user_name]

で検索ができる。

と、ここまでは検索すればすぐに出てくるが、このauthor or committer の違いをわかっていない分にはこれだとなんとももどかしい。ということで調べた。


git はすべてのcommitにAuthorとCommitterの情報を記録している。

Author - コードを書いた人
Committer - リポジトリにコミットした人

この違いは過去のコミットを操作した際などに重宝される。

つまり、ある人がコードを書いてそれをコミットしたあとにgit commit --amend などで他の誰かが改変した場合にもAuthorは変更されず、あくまでCommitterのみが変更される。

ちなみにAuthorごと過去を改変することも可能なようだが、あまり利用ケースが思いつかない。その人がいた事自体を消したい場合、あるいは見せたくない本名やアドレスが含まれていた場合などだろうか…?

通常の git log コマンドではAuthorしか表示されない。

Committerも一緒に表示させるにはoptionをつけて git log --pretty=full などとするとよい。

参考)

Git - git-log Documentation - Git SCM

Difference between author and committer in Git? - Stack Overflow


この記事は著者のブログからの転載記事となります。

自分のcommit logだけを見たい!author,committerの違いとは。 - DOT NOTES

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4