当我对一个文件运行 git blame 时(使用 msysgit),我总是得到以下类型的打印输出:
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 1) package co
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 2) {
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 3) impor
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 4) impor
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 5) impor
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 6) impor
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 7) impor
即它将所有行显示为尚未提交。
我在很多文件上尝试过这个,有很多提交 - 总是相同的结果。我也试过使用相对/完整路径,但似乎没有什么区别。
当我尝试使用 TortoiseGit 的 blame 时,它总是在第一次提交时显示每一行都是最后提交的:
甚至认为,正如我所说,这些文件的历史记录中实际上有数十次提交..
想法?
编辑 - 更多信息
- Git blame 在托管此存储库的 GitHub 上运行良好。
- 如果我将它克隆到 linux 机器上并在那里做 blame,它也能正常工作
- 似乎只有在 msysgit 上这行不通
最佳答案
git blame file.txt
归咎于您的工作副本中 file.txt 的版本。如果 file.txt 在 repo 中有 Windows 换行符 (CRLF) 并且你有 core.autocrlf = true
, 那么 file.txt 的每一行都会被认为是不同的,并且会被 git blame
报告尚未 promise 。
为什么git blame <my_branch>
的原因(或者更好的 git blame HEAD
,无论您在哪个分支上都有效)有效,是因为它不会归咎于工作副本版本,因此没有可能出现尚未提交的行。
关于Git blame 没有显示历史记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4638500/