Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git blame ignoring specific commit [duplicate]

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.

like image 206
Malov Vladimir Avatar asked Aug 02 '19 13:08

Malov Vladimir


People also ask

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 Get Out of git blame?

You can also quit the git blame window using the q key on your keyboard. Now, if you want to learn more about what changed in a commit, simply copy the commit hash and use git log as follows. You should be able to see the full commit message, what lines are removed and what lines are added since the commit before it.

What does git blame do?

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.

What is blame annotate in git?

From git-blame: Annotates each line in the given file with information from the revision which last modified the line. Optionally, start annotating from the given revision. When specified one or more times, -L restricts annotation to the requested lines.


Video Answer


1 Answers

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

like image 70
Michiel Leegwater Avatar answered Oct 18 '22 03:10

Michiel Leegwater