Blame
一句话解释
Git blame shows 提交 and author for 每个行 的 file — 它答案 '谁 wrote 这个行 and 当?'
用大白话说
git blame <file> shows each line of the file annotated with the commit hash, author, and date of the last change to that line. It is the "谁 wrote 这个 code" tool.
Blame is useful for understanding code history: finding who to ask about a confusing line, seeing when a bug was introduced, or understanding the age of code. Despite the name, it is not about assigning blame — it is about understanding context.
Use git blame -L 10,20 <file> to blame only lines 10-20. Many editors and GitHub integrate blame inline, showing annotations next to each line. The alias git annotate does the same thing with a friendlier name.
示例
# Blame a file
git blame app.js
# abc1234 (Alice 2024-01-15 10:00:00) const port = 3000;
# def5678 (Bob 2024-02-20 14:30:00) const host = 'localhost';
# Blame specific lines
git blame -L 10,20 app.jsblame shows 提交, author, and date for 每个行.
相关术语
相关资源
相关课程
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。