'git blame'是做什么的? [英] What does 'git blame' do?

查看:308
本文介绍了'git blame'是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了很多有关使用git blame的方法的问题,但我并不真正理解它们.

I saw a lot of questions about methods of using git blame, but I don't really understand them.

我在GitHub界面上的文件顶部看到一个 Blame 按钮.单击它后,它在左侧栏上显示一些带有用户名的差异.这说明什么?

I see a Blame button on top of files on the GitHub interface. Upon clicking it, it shows some diff with usernames on the left bar. What does that indicate?

除了GitHub之外,为什么实际使用git blame?

Why is git blame actually used, apart from GitHub?

推荐答案

来自 git-怪 :

使用上次修改该行的修订版本的信息来注释给定文件中的每一行. (可选)从给定的修订版本开始注释.

Annotates each line in the given file with information from the revision which last modified the line. Optionally, start annotating from the given revision.

指定一次或多次后,-L将注释限制为所请求的行.

When specified one or more times, -L restricts annotation to the requested lines.

示例:

johndoe@server.com:~# git blame .htaccess
...
^e1fb2d7 (John Doe 2015-07-03 06:30:25 -0300  4) allow from all
^72fgsdl (Arthur King 2015-07-03 06:34:12 -0300  5)
^e1fb2d7 (John Doe 2015-07-03 06:30:25 -0300  6) <IfModule mod_rewrite.c>
^72fgsdl (Arthur King 2015-07-03 06:34:12 -0300  7)     RewriteEngine On
...

请注意,git blame并未按时间顺序显示每行的修改历史记录. 它仅显示谁是最后更改文档中的一行直到HEAD中的最后一次提交的人.

Please note that git blame does not show the per-line modifications history in the chronological sense. It only shows who was the last person to have changed a line in a document up to the last commit in HEAD.

也就是说,要查看文档行的完整历史记录/日志,您需要为git log中的每次提交运行git blame path/to/file.

That is to say that in order to see the full history/log of a document line, you would need to run a git blame path/to/file for each commit in your git log.

这篇关于'git blame'是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆