Revision ranges

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 either, but not both

See gitrevisions.

Basic filters

Count and skip

-n, --max-count=2
    --skip=2

By date

    --since="1 week ago"
    --until="yesterday"

By person

    --author="Rico"
    --committer="Rico"

By message or code

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

Refine matches

    --invert-grep
    --all-match                   # AND in multi --grep

Limiting

Merge commits

    --merges
    --no-merges

First parent only

    --first-parent          # no stuff from merged branches

By ref

    --branches="feature/*"
    --tags="v*"
    --remotes="origin"

Simplification

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

Ordering

    --date-order
    --author-date-order
    --topo-order              # "smart" ordering
    --reverse

Formatting

    --abbrev-commit
    --oneline
    --graph

Custom formats

    --pretty="format:%H"

See: Git log format cheatsheet

Also see

0 Comments for this cheatsheet. Write yours!