git log

Browse, filter, and format Git commit history.

low risk

interactive breakdown — edit the command and press Explain
$ 
What it does

git log displays the commit history with flexible formatting. Supports filtering by author, date, path, and content. The --graph flag visualizes branch topology. A well-formatted git log is essential for code review, debugging, and release management.

Common flags
FlagMeaning
--onelineCompact one-line per commit
--graphASCII branch topology graph
--authorFilter by author
--sinceFilter commits since a date
--statShow file change stats per commit
-p --patchShow full diff per commit
--followFollow file renames
Examples
git log --oneline --graph --decorate --allVisual branch history for all branches · explain & risk-check →
git log --since='2 weeks ago' --author='Eknatha' --onelineRecent commits by specific author · explain & risk-check →
git log --stat HEAD~5..HEADFiles changed in last 5 commits · explain & risk-check →
git log -S 'function_name' --onelineFind when a specific string was added/removed · explain & risk-check →
git log --follow -p -- path/to/file.goFull history of a file including renames · explain & risk-check →
Pro tip

Add `git log --oneline --graph --decorate --all` as an alias `git lg` — the graph view reveals merge topology that linear history completely hides.

Related
git stash git rebase diff
Open the full explainer →More in Git

Reference text is hand-written and may be incomplete — check man git for your version. Test destructive commands on a non-production system first.