Git — Logs
Basic Log
git log
Compact Log
git log --oneline
Graph View
git log --oneline --graph
Show Changes
git log -p
Filter by Author
git log --author="John"
Filter by Date
git log --since="2024-01-01"
git log --until="2024-12-31"
Specific File
git log -- path/to/file
Pretty Format
git log --pretty=format:"%h - %an, %ar : %s"
Limit Results
git log -10 # Last 10 commits
git log --skip=5 -5 # Skip 5, show 5
Useful Options
| Option | Description |
|---|---|
| --oneline | Compact view |
| --graph | Visual graph |
| --stat | Show file changes |
| --author | Filter by author |
| --since | Filter by date |
Mini Practice
- View commit history
- Use different formats
- Filter commits
- View file history
Up Next
Continue with Diff — comparing changes.
Related Topics
Frequently Asked Questions about Logs
What is Logs in Git?
Logs is a fundamental concept in Git. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Logs?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Logs.
Why is Logs important in Git?
Logs is essential for Git development. Understanding this concept will help you write better code and solve real-world problems more effectively.