Git Blame 没有显示任何历史记录
当我在文件上运行 gitblame(使用 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的责任时,它总是将每一行显示为在第一次提交时最后提交的:
甚至认为,正如我所说,这些文件的历史记录中实际上有数十次提交..
有想法吗?
编辑 - 更多信息
- Git Blame 在托管此存储库的 GitHub 上运行良好。
- 如果我将它克隆到 Linux 机器并在那里进行指责,它也可以正常工作
- 似乎只有在 msysgit 上这不起作用
When I run git blame on a file (using msysgit) I always get the following sort of printout:
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
i.e. it shows all lines as Not Yet Committed.
I tried this on many files, that have many commits - always the same results. I also tried using relative/full path, but it seems to make no difference.
When I try to use TortoiseGit's blame it always shows every line as being last committed at the first commit:
even thought, as I've said, there are actually tens of commits in the history of these files..
Ideas?
Edit - More Info
- Git blame works fine on GitHub, where this repo is hosted.
- It also works fine if I clone it to a linux machine and do the blame there
- It seems that only on msysgit this doesn't work
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从 git 2.0.1(2014 年 6 月 25 日)开始,gitblame 应该停止报告所有那些“尚未提交”的行。
请参阅 commit 4d4813a(2014 年 4 月 26 日),作者:brian m.卡尔森 (
bk2204
)。(由 Junio C Hamano --
gitster
-- 合并于 提交 e934c67,2014 年 6 月 6 日)radon8472 添加了 评论:
Starting git 2.0.1 (June 25th, 2014), git blame should stop reporting all those "Not Yet Committed" lines.
See commit 4d4813a (26 Apr 2014) by brian m. carlson (
bk2204
).(Merged by Junio C Hamano --
gitster
-- in commit e934c67, 06 Jun 2014)radon8472 adds in the comments:
另一种可能性:区分大小写的文件名拼写错误
我对 git irrelevant file.txt 遇到了同样的问题,然后意识到我用 file.txt 做了区分大小写的文件名拼写错误
将其更改为 File.txt (例如),然后我获得了预期结果,无需指定 my_branch: gitblame File.txt
Another possibility: case-sensitive filename typo
I had the same problem with git blame file.txt, then realized that I'd made a case-sensitive filename typo with file.txt
Changed it to File.txt (for example), and I got the expected results w/o having to specify my_branch: git blame File.txt
git Blame file.txt
归咎于工作副本中 file.txt 的版本。如果 file.txt 在存储库中包含 Windows 换行符 (CRLF),并且您有core.autocrlf = true
,则 file.txt 的每一行将被视为不同,并由git 报告归咎于尚未提交。
git Blanch
(或者更好的git Blanch HEAD
,无论你在哪个分支上都可以)起作用的原因是它不工作归咎于工作副本版本,因此不可能出现尚未提交的行。git blame file.txt
blames the version of file.txt in your working copy. If file.txt has Windows-newlines (CRLF) in the repo and you havecore.autocrlf = true
, then every line of file.txt will be considered different and will be reported bygit blame
as not yet committed.The reason why
git blame <my_branch>
(or even bettergit blame HEAD
, which works no matter what branch you're on) works, is that it doesn't blame the working copy version so there's no potential for lines not yet being committed.找到了解决方案 - 非常奇怪。
如果我运行此命令:
历史记录已被破坏,如上面发布的。
如果我这样做:
它有效!
这很奇怪,因为 AFAICS 的用法不需要分支名称:
Found the solution - very weird.
If I run this:
The history is broken, as posted above.
If I do this instead:
It works!
This is very weird, because AFAICS the usage doesn't require a branch name: