Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git blame showing no history

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:

alt text

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
like image 480
Assaf Lavie Avatar asked Jan 09 '11 09:01

Assaf Lavie


People also ask

What does blame mean in git?

Summary. The git blame command is used to examine the contents of a file line by line and see when each line was last modified and who the author of the modifications was. The output format of git blame can be altered with various command line options.

How do I use git blame ignore revs?

In your repository, create a file to hold commit hashes of commits to be ignored by git blame . Naming this file . git-blame-ignore-revs seems to be a common convention. This causes git to automatically ignore the commits specified in that file for every call to git blame .

How do I git blame on GitHub?

On GitHub.com, navigate to the main page of the repository. Click to open the file whose line history you want to view. In the upper-right corner of the file view, click Blame to open the blame view.


1 Answers

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 have core.autocrlf = true, then every line of file.txt will be considered different and will be reported by git blame as not yet committed.

The reason why git blame <my_branch> (or even better git 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.

like image 178
kusma Avatar answered Sep 26 '22 15:09

kusma