Exploring History - log

git log like a pro

The raw git log is verbose. These make it useful:

CommandShows
git log --onelineOne compact line per commit
git log --graph --oneline --allASCII branch/merge graph
git log -pFull patch (diff) for each commit
git log --statFiles changed per commit
git log --author="Alice"Filter by author
git log --since="2 weeks ago"Filter by date
git log -- path/to/fileHistory of one file
git log -S"functionName"Commits that added/removed that text (pickaxe)
$ git log --oneline --graph --all
* a1b2c3d (HEAD -> main) Merge feature-login
|\
| * 9f8e7d6 (feature-login) Add login form
* | 7c6b5a4 Update README
|/
* 000aaa1 Initial commit
Tip: git log -S"getUser" (pickaxe) is a superpower for debugging: it finds the exact commit where a string first appeared or disappeared - perfect for "when did this function get deleted?"