如果你要查看文件的每个部分是谁修改的, 那么 git blame 就是不二选择. 只要运行’git blame [filename]’, 你就会得到整个文件的每一行的详细修改信息:包括SHA串,日期和作者:

gao@Dell:/mnt/c/Users/gaoji/workspace/wiki$ git blame .gitignore                                                                                              e888f145 (wuzhi1234 2018-05-27 11:24:18 +0800  1) .idea/
e888f145 (wuzhi1234 2018-05-27 11:24:18 +0800  2) .DS_Store
e888f145 (wuzhi1234 2018-05-27 11:24:18 +0800  3) Thumbs.db
e888f145 (wuzhi1234 2018-05-27 11:24:18 +0800  4) db.json
e888f145 (wuzhi1234 2018-05-27 11:24:18 +0800  5) *.log
e888f145 (wuzhi1234 2018-05-27 11:24:18 +0800  6) node_modules/
e888f145 (wuzhi1234 2018-05-27 11:24:18 +0800  7) public/
e888f145 (wuzhi1234 2018-05-27 11:24:18 +0800  8) .deploy*/
e888f145 (wuzhi1234 2018-05-27 11:24:18 +0800  9) package-lock.json
8cad193c (wuzhi1234 2018-07-22 10:31:41 +0800 10) _config.yml
891d243e (wuzhi1234 2019-06-09 22:25:55 +0800 11) .vscode/

你也可以用"-L"参数在命令(blame)中指定开始和结束行:

gao@Dell:/mnt/c/Users/gaoji/workspace/wiki$ git blame -L 3,+2 .gitignore                                                                                      e888f145 (wuzhi1234 2018-05-27 11:24:18 +0800 3) Thumbs.db
e888f145 (wuzhi1234 2018-05-27 11:24:18 +0800 4) db.json