37 lines
601 B
Markdown
37 lines
601 B
Markdown
# Viewing the Commit History
|
|
|
|
## Goal
|
|
Inspect commit history in different formats and levels of detail.
|
|
|
|
## Basic Log
|
|
```bash
|
|
cd ~/lab-git-essentials/my-first-repo
|
|
git log
|
|
```
|
|
|
|
## One-Line, Decorated, with Graph
|
|
```bash
|
|
git log --oneline --decorate --graph --all
|
|
```
|
|
|
|
## Show a Specific Commit
|
|
```bash
|
|
# Copy a commit SHA from the log
|
|
git show <SHA>
|
|
```
|
|
|
|
## Filter by File or Author
|
|
```bash
|
|
git log -- README.md
|
|
git log --author "Your Name"
|
|
```
|
|
|
|
## Statistics and Patches
|
|
```bash
|
|
git log --stat -n 5
|
|
git log -p -n 1
|
|
```
|
|
|
|
## Outcome
|
|
You can read history, view diffs, and filter logs by file or author.
|