Git Cheatsheet - Quick Git Command Reference

Quick reference for common Git commands. Search, copy, and use Git commands instantly.

Share
Back to Git Cheatsheet

git log

Show commit logs

Syntax

git log [options] [<revision-range>]

Common Options

OptionDescription
--onelineCompact one-line format
--graphGraphical branch history
--allShow all branches
--decorateShow refs (branches, tags)
--statShow change statistics
-n <number>Show last n commits
--author=<name>Filter by author
--since=<date>Filter by since date
--grep=<pattern>Filter by commit message pattern
-S <string>Search code changes
-pShow patch diff per commit
--pretty=<format>Custom output format

Examples

git log

View full commit history

git log --oneline --graph --all

Graphical all-branch history

git log --author="John" --since="1 week ago"

Commits by John in last week

git log -S "keyword"

Find commits that added keyword

git log --grep="fix"

Commits with "fix" in message

Related Commands

git diffgit showgit blamegit reflog

Related Tools

More Code & Dev Tools