Git blame 没有显示历史记录

标签 git windows-subsystem-for-linux msysgit blame

当我对一个文件运行 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 时,它​​总是在第一次提交时显示每一行都是最后提交的:

alt text

甚至认为,正如我所说,这些文件的历史记录中实际上有数十次提交..

想法?

编辑 - 更多信息

  • 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/

相关文章:

git - 忽略 bash 反引号执行而不转义 git commit 中的 ` 字符

git - git-强制更新。发生了什么?

java - 如何从 java 顺序执行 wsl 命令?

git - 如何找出分支中哪些文件已被修改?

windows - 从 Git Bash 调用 Notepad++

git - 无法让 git 与 iconv 和 utf-16 一起玩

python - 如何使用Docker将当前的部署方法迁移到一种方法?

linux - 如何从本地安装的 Ubuntu 访问我的 WSL2 文件?

windows - 为什么 Windows 上的 bash 会说 "No such file or directory"?

git - 我可以依赖 `git fetch <sha>` 吗?