Chapter 4 of 14All chapters
Chapter 4 of 14
History and diffs
Looking at what happened and when.
Reading the log
git log lists commits newest first. Most people keep an alias for a compact view such as git log --oneline --graph --decorate, which draws the branch structure.
- git show <commit> prints one commit with its diff.
- git blame <file> tells you which commit last touched each line.
Searching
git log -S"text" finds commits that added or removed a piece of text, which beats scrolling when you are hunting for where something appeared.