What is git blame?
Answer
git blame shows who last modified each line of a file, along with the commit hash and timestamp. It's used to understand why a piece of code was written and who to ask about it. Usage: git blame file.txt — shows every line annotated with author, date, and commit hash; git blame -L 10,20 file.txt — only lines 10-20; git blame -w file.txt — ignore whitespace changes; git blame -M file.txt — detect lines moved within the same file; git blame --since="2024-01-01" file.txt — only blame before a date. Output format: abc1234 (Alice 2024-01-15 10:30:00 -0500 42) const MAX_SIZE = 1024; — hash, author, date, line number, content. Jumping back further: if a line shows a commit that only moved it, use git log -p abc1234 to find the original authorship. IDE integration: most IDEs and editors (VS Code Git Lens, IntelliJ) show inline blame annotations. Note: the name "blame" is a bit misleading — it's more about understanding context and history than assigning fault. If you see something strange, use blame to find the commit, then git show abc1234 to understand why the change was made.