我想知道在哪个提交中添加了下面给出的代码:
if (getListView().getChildCount() == 0)
getActivity().findViewById(android.R.id.empty).setVisibility(View.VISIBLE);
Run Code Online (Sandbox Code Playgroud)
我该如何实现这一目标?
Rah*_*mad 57
git log -S searchTerm
Run Code Online (Sandbox Code Playgroud)
为您提供引入搜索词的提交.
Lei*_*igh 56
git blame在文件上运行.它将向您显示每行的提交ID,日期和时间以及提交者.然后只需复制提交标识符,您就可以在git log <commit>或中使用它git show <commit>.
例如,我有一个名为test.txt的文件,在不同的提交中添加了行:
$ cat test.txt
First line.
Second line.
Run Code Online (Sandbox Code Playgroud)
运行git blame:
$ git blame test.txt
^410c3dd (Leigh 2013-11-09 12:00:00 1) First line.
2365eb7d (Leigh 2013-11-09 12:00:10 2) Second line.
Run Code Online (Sandbox Code Playgroud)
第一位是提交ID,然后是名称,然后是日期,时间,时区,最后是行号和行内容.
cfo*_*ish 40
有一些东西比在整个文件上发布指责更快.如果该行是${lineno},文件是${filename}你可以:
git blame -L ${lineno},${lineno} ${filename}
Run Code Online (Sandbox Code Playgroud)
例:
git blame -L 2,2 test.txt
Run Code Online (Sandbox Code Playgroud)
ans*_*hul 10
git log -S "mention here line of code" [file-path]
Run Code Online (Sandbox Code Playgroud)
例如:
git log -S "First line" test.txt
Run Code Online (Sandbox Code Playgroud)
提供文件名及其路径是显而易见的,因为在大多数情况下,我们想知道是谁在特定文件中引入了特定代码段。
| 归档时间: |
|
| 查看次数: |
20781 次 |
| 最近记录: |