本帖最后由 康师傅 于 2013-4-26 01:16 编辑
Git blame可以帮助你发现某个文件每一行是由谁最后做了修改,blame的意思是谴责,就是想看一下谁捣鼓了这个文件,把build给搞失败了(当然,实际项目中并不一定需要谴责哈,因为那个人很可能就是你,只是便于记忆)。
Another nice trick from Sarah Grey: git blame. We were looking for the author of a strange code change that broke one of our tests. Git blame allows you to find easily who made what change in your terminal: git blame fileThere are more options available:
usage: git blame [options] [rev-opts] [rev] [--] file
–incremental Show blame entries as we find them, incrementally
-b Show blank SHA-1 for boundary commits (Default: off)
–root Do not treat root commits as boundaries (Default: off)
–show-stats Show work cost statistics
–score-debug Show output score for blame entries
-f, –show-name Show original filename (Default: auto)
-n, –show-number Show original linenumber (Default: off)
-p, –porcelain Show in a format designed for machine consumption
-c Use the same output mode as git-annotate (Default: off)
-t Show raw timestamp (Default: off)
-l Show long commit SHA1 (Default: off)
-s Suppress author name and timestamp (Default: off)
-e, –show-email Show author email instead of name (Default: off)
-w Ignore whitespace differences
-S <file> Use revisions from <file> instead of calling git-rev-list
–contents <file> Use <file>’s contents as the final image
-C[<score>] Find line copies within and across files
-M[<score>] Find line movements within and across files
-L <n,m> Process only line range n,m, counting from 1
Here is an example that shows my recent changes to a Gemfile:
http://jeanbahnik.com/2012/05/using-git-blame/
|