Git Log and History
Inspect commit history, search it, and find when code changed.
- git log
- git show
- git blame
- git pickaxe
- commit history
Git Log and History
Inspect commit history, search it, and find when code changed.
Commands
| Command | What it does |
|---|---|
git log --oneline -10 | Compact last 10 commits |
git log --graph --oneline --all | Graph of all branches |
git log -S "token" --oneline | Find commits adding/removing a string |
git log -- <file> | History of one file |
git show <commit> --stat | Show one commit with changed files |
git blame -L 10,20 <file> | Who changed each line in a range |
Example
git log --graph --oneline --all -12
git log -S "retry" --oneline -- src/pay.ts
git show a1b2c3d --stat
FAQ
How do I find which commit broke a file?
Use git log -- <file> to narrow, then git show each suspect, or bisect for large ranges.
Why is git log slow on big repos?
Add --oneline with paths or --since, or use a shallow/p partial clone for huge histories.
Preguntas frecuentes
How do I find which commit broke a file?
Use git log -- <file> to narrow, then git show each suspect, or bisect for large ranges.
Why is git log slow on big repos?
Add --oneline with paths or --since, or use a shallow/p partial clone for huge histories.
Git
Git Config Essentials
Set identity, defaults, and aliases for Git on a new machine.
Git Clone and Init
Start a repo from scratch or copy a remote repository locally.
Git Add and Commit
Stage changes and record them as commits with clear messages.
Git Branch Basics
Create, list, rename, and delete branches for parallel work.