ZANARDI Bruno

Software Developper

About
Resume

Git Blog

Git command `log`

Definition

Shows the commit logs.

Basic usage

Shows all parent commits of your version with few informations (authors, date and message).

$ git log

Shows the log for <file>

$ git log <file>

Advanced usage

Each commit on one line (only hash and message)

$ git log --pretty=oneline

The two last commits

$ git log --max-count=2

All commits in the branch younger than 5 minutes

$ git log --since='5 minutes ago'

All commits in the branch older than 1 day

$ git log --until='1 day ago'

All commits from this author

$ git log --author=<name>

All commits from all branches

$ git log --all

All commits with an ‘ascii’ graph

$ git log --graph --all

Shows the changed files list and number of added/removed lines

$ git log --stat

Shows the commits patches

$ git log -p

Expert usage

Shows commits where patch contains <regex_string> in <file>

$ git log -G'<regex_string>' -- <file>

Shows commits where patch contains case sensitive <regex_string> in <file>

$ git log -i -G'<regex_string>' -- <file>

Shows commits where <string> appears in or disappears from <file>

$ git log -S'<string>' -- <file>

Shows commits where case sensitive <string> appears in or disappears from <file>

$ git log -i -S'<string>' -- <file>

Shows commits where <regex_string> appears in or disappears from <file>

$ git log -S'<regex_string>' --pickaxe-regex -- <file>

Shows commits where case sensitive <regex_string> appears in or disappears from <file>

$ git log -i -S'<regex_string>' --pickaxe-regex -- <file>