Search code examples
gitversion-controlgit-blame

Git blame ignoring specific commit


I use git blame command to see in which commit have been added some particular code line, but sometimes I bump into the same problem: someone has made some kind of code formatting, or has changed function interface and refreshed all client code.

Eventually git blame show me only this last commit on particular code line. How ignore this commit and see what happened before it?

Of course I can checkout on commit before format-edited commit and see blame again, but it may take a lot of time on huge project and doesn't appropriate.


Solution

  • I think you are looking for the -w option that excludes white space. According to the man page.

    Ignore whitespace when comparing the parent’s version and the child’s to find where the lines came from.

    Moved code can also be excluded. See the -M and -C options. See https://git-scm.com/docs/git-blame