Git Log Cheat Sheet

From WikiOD

Here is the cheatsheat of Git Log and basic guide on how to use Git Log

Revision ranges[edit | edit source]

git log master             # branch
git log origin/master      # branch, remote
git log v1.0.0             # tag

git log master develop

git log v2.0..master       # reachable from *master* but not *v2.0*
git log v2.0...master      # reachable from *master* and *v2.0*, but not both

See [[./git-revisions|gitrevisions]].

Basic filters[edit | edit source]

-n, --max-count=2
    --since="1 week ago"

Search[edit | edit source]

    --grep="Merge pull request"   # in commit messages
    -S"console.log"               # in code
    -G"foo.*"                     # in code (regex)
    --all-match                   # AND in multi --grep

Limiting[edit | edit source]

    --first-parent          # no stuff from merged branches

Simplification[edit | edit source]

git log -- app/file.rb          # only file
    --simplify-by-decoration    # tags and branches

Ordering[edit | edit source]

    --topo-order              # "smart" ordering

Formatting[edit | edit source]


Custom formats[edit | edit source]


See: [[./git-log-format|Git log format cheatsheet]]

Also see[edit | edit source]

  • [[./git-log-format|Git log format cheatsheet]]