git blame
Show who last modified each line of a file and when
Syntax
git blame [<options>] [<rev>] [--] <file>
Parameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
-L <start>,<end> |
|
Common | |
-w |
|
Common | |
-C |
Copy | |
Common |
-e |
|
Common | |
--since <date> |
|
Common |
Examples
git blame src/utils.js
a1b2c3d ( 2024-03-15) function formatDate() {
10-20
git blame -L 10,20 src/app.js
,
git blame -w src/style.css
Copy
git blame -C src/newFile.js
log
git log --follow -p -- src/utils.js
Tips
- blame "",
- -w,
- git show <commit-hash>
- VS Code GitLens provides blame