LoginSignup
500
484

More than 5 years have passed since last update.

git log よく使うオプションまとめ

Last updated at Posted at 2015-01-23

git logはオプションがありすぎて全然使いこなせていなかったので
よく使いそうなものだけまとめた。

表示形式

git log --oneline --graph --decorateでそこそこ見やすく表示される。
自前のaliasが設定されていない環境でgitを使うときに頭に入れておくとよいかも。

自分は以下のようなaliasを設定している。

[alias]
    graph = log --graph --date=short --pretty=\"format:%C(yellow)%h %C(cyan)%ad %C(green)%an%Creset%x09%s %C(red)%d%Creset\"

ファイル毎の削除、追加行数を表示

$ git log --numstat

変更したファイルを表示

$ git log --name-status

コミットの絞り込み

日付で

$ git log --since="4 days ago" --until="2015/01/22"

表示数

$ git log -n 10

特定のファイルのみ

$ git log -- path/to/*.sh

コミッターで

$ git log --author='take4s5i'

コミットログで

$ git log --grep='typo'

マージコミットのみ

$ git log --merges

マージコミットを除く

$ git log --no-merges

マージコミットのマージ元を非表示

$git log --first-parent

全ブランチ

$ git log --all
500
484
1

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
500
484