原文: http://gitbook.liuhui998.com/5_5.html

 如果你要查看文件的每个部分是谁修改的, 那么 git blame 就是不二选择. 只要运行'git blame [filename]', 你就会得到整个文件的每一行的详细修改信息:包括SHA串,日期和作者:
 
译者注: Git采用SHA1做为hash签名算法, 在本书中,作者为了表达方便,常常使用SHA来代指SHA1. 如果没有特别说明, 本书中的SHA就是SHA1的代称.
$ git blame sha1_file.c
...
0fcfd160 (Linus Torvalds  2005-04-18 13:04:43 -0700    8)  */
0fcfd160 (Linus Torvalds  2005-04-18 13:04:43 -0700    9) #include "cache.h"
1f688557 (Junio C Hamano  2005-06-27 03:35:33 -0700   10) #include "delta.h"
a733cb60 (Linus Torvalds  2005-06-28 14:21:02 -0700   11) #include "pack.h"
8e440259 (Peter Eriksen   2006-04-02 14:44:09 +0200   12) #include "blob.h"
8e440259 (Peter Eriksen   2006-04-02 14:44:09 +0200   13) #include "commit.h"
8e440259 (Peter Eriksen   2006-04-02 14:44:09 +0200   14) #include "tag.h"
8e440259 (Peter Eriksen   2006-04-02 14:44:09 +0200   15) #include "tree.h"
f35a6d3b (Linus Torvalds  2007-04-09 21:20:29 -0700   16) #include "refs.h"
70f5d5d3 (Nicolas Pitre   2008-02-28 00:25:19 -0500   17) #include "pack-revindex.h"628522ec (Junio C Hamano              2007-12-29 02:05:47 -0800   18) #include "sha1-lookup.h"
...
你也可以用"-L"参数在命令(blame)中指定开始和结束行:
$>git blame -L 160,+10 sha1_file.c 
ace1534d (Junio C Hamano 2005-05-07 00:38:04 -0700       160)}
ace1534d (Junio C Hamano 2005-05-07 00:38:04 -0700       161)
0fcfd160 (Linus Torvalds 2005-04-18 13:04:43 -0700       162)/*
0fcfd160 (Linus Torvalds 2005-04-18 13:04:43 -0700       163) * NOTE! This returns a statically allocate
790296fd (Jim Meyering   2008-01-03 15:18:07 +0100       164) * careful about using it. Do an "xstrdup()
0fcfd160 (Linus Torvalds 2005-04-18 13:04:43 -0700       165) * filename.
ace1534d (Junio C Hamano 2005-05-07 00:38:04 -0700       166) *
ace1534d (Junio C Hamano 2005-05-07 00:38:04 -0700       167) * Also note that this returns the location
ace1534d (Junio C Hamano 2005-05-07 00:38:04 -0700       168) * SHA1 file can happen from any alternate 
d19938ab (Junio C Hamano 2005-05-09 17:57:56 -0700       169) * DB_ENVIRONMENT environment variable if i
 
 
 
 
 

查找问题的利器 - Git Blame的更多相关文章

  1. 查找问题的利器 - Git Bisect

    原文:http://gitbook.liuhui998.com/5_4.html 假设你在项目的'2.6.18'版上面工作, 但是你当前的代码(master)崩溃(crash)了. 有时解决这种问题的 ...

  2. [转]查找问题的利器 - Git Bisect

    转自:http://gitbook.liuhui998.com/5_4.html 假设你在项目的'2.6.18'版上面工作, 但是你当前的代码(master)崩溃(crash)了. 有时解决这种问题的 ...

  3. Git基础 - git blame

    当想知道一段代码历史上有哪些人修改时,可以使用git blame查看,正如其名,当你看到那段让你抓狂的代码时,一定想找出是谁写的来一顿blame吧 : ) 使用方法 icebug@localhost: ...

  4. [Practical Git] Show who changed a line last with git blame

    When working on a file, we often want to know who made certain changes last; we can use git blame to ...

  5. 如果你要查看文件的每个部分是谁修改的, 那么 git blame 就是不二选择

    原文: http://gitbook.liuhui998.com/5_5.html 如果你要查看文件的每个部分是谁修改的, 那么 git blame 就是不二选择. 只要运行'git blame [f ...

  6. 不常用但很有用的git show 和 git blame

    团队使用git 合作时,可能遇见想要查看一段比较难以阅读代码, 此时可能需要联系最新的修改者是哪位,这时候最有用的最快捷的方法就是git blame 啦, 这个指令的output是一个文件的各个区域段 ...

  7. git blame 查看某行代码提交记录

    1. 在当前git项目目录下执行 git blame -L 38,38 <filename> 例子:  git blame -L 38,38 src/component/BarCode/i ...

  8. Git blame

    一.简介 git blame可以将文件中的每一行的作者.最新的变更提交和提交时间展示出来.   二.实例 http://blog.csdn.net/hudashi/article/details/76 ...

  9. 烂代码 git blame

    关于烂代码的那些事(上) - Axb的自我修养 http://blog.2baxb.me/archives/1343 关于烂代码的那些事(上) 六月 21, 2015 57 条评论 目录 [显示] 1 ...

随机推荐

  1. MySQL取每组的前N条记录

    一.对分组的记录取前N条记录:例子:取前 2条最大(小)的记录 .用子查询: SELECT * FROM right2 a WHERE > (SELECT COUNT(*) FROM right ...

  2. Log4Net使用方法

    项目里都会用到日志记录..特别是在本地跑的欢畅..一上服务器就嗝屁的时候..日志会帮你大忙.. Log4net算是一种应用的最广泛的日志记录方式了..下面来简略的说下他的用法.. 先下载log4net ...

  3. linq/EF/lambda 比较字符串日期时间大小

    在使用EF时,想要比较字符串类型的日期时,参考以下: SQL语句: 1 2 3 4 1)select * from TableName where StartTime > '2015-04-08 ...

  4. 自定义列表dl的使用原因和场合

    为什么要使用自定义列表? dl和ol, ul的区别? 要正确理解dl的意图, 理解 dl的 "语义" ! 才能知道为什么要使用dl, 以及在什么时候/ 什么情况下使用 dl? dl ...

  5. 如何在服务器上搭建git服务器

    参考文章: http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/00137583770 ...

  6. hdu4923 Room and Moor

    4923Room and Moor Room and Moor Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 262144/2621 ...

  7. c# 获取系统时间

    //获取日期+时间DateTime.Now.ToString();             // 2008-9-4 20:02:10DateTime.Now.ToLocalTime().ToStrin ...

  8. 30秒搭建Github Page

    如果中国每个程序员都写博客,那么中国IT届的春天就来了 原文转自我的前端博客,链接:http://www.hacke2.cn/create-github-page/ 有同学问我的网站是怎么创建的,其实 ...

  9. 开机自动连接/断开VPN 批处理

    或许大家在工作或生活中有接触到VPN,如果使用Windows自带的VPN来连接,每次开机要像宽带拨号那样,右击该VPN连接图标,然后选择“连接”(如果未记住密码甚至还要输入密码),然后点击确定,有点麻 ...

  10. BSA基础数据维护

    平台 BSA基础数据维护 .扇区五个字段的内容 本来值为0,经过107上计算解析,得出正常的数值.然后106上报(200050),得到回复(200051). 查看回复数据,是否有错误.比如提示104 ...