What makes git to blame?

I saw a lot of questions about methods for using git blame but I really don't understand them.

I see the blame button on top of the files on the github interface. When you click on it, it shows some differences with usernames in the left panel. What does this mean?

Why is Git Blame actually used besides GitHub?

+192
git git-blame
Jul 03 '15 at 9:15
source share
5 answers

From git -scm http://git-scm.com/docs/git-blame

Indicates each line in a given file with information from the revision that last modified the line. Optionally, start annotating with this revision.

If specified one or more times, -L restricts the annotation to the requested lines.

Example:

 johndoe@server.com:~# git blame .htaccess ... ^e1fb2d7 (John Doe 2015-07-03 06:30:25 -0300 4) allow from all ^72fgsdl (Arthur King 2015-07-03 06:34:12 -0300 5) ^e1fb2d7 (John Doe 2015-07-03 06:30:25 -0300 6) <IfModule mod_rewrite.c> ^72fgsdl (Arthur King 2015-07-03 06:34:12 -0300 7) RewriteEngine On ... 

Note that git blame does not show a history of changes in a chronological sense. It shows only who was the last person who changed the line in the document until the last commit in HEAD .

That is, to view the full history / history of a document line, you need to run git blame path/to/file for each commit in git log .

+144
Jul 03 '15 at 10:49
source share

The team explains itself pretty well to find out which of the employees wrote a specific line or destroyed the project so you can blame them :)

+85
Apr 13 '17 at 9:06 on
source share

From GitHub https://help.github.com/articles/using-git-blame-to-trace-changes-in-a-file

The Guilty Command is a Git feature designed to help you determine who made changes to the file.

Despite its negative sound, the git accusation is actually quite harmless; its main function is to indicate who changed the lines in the file and why. This can be a useful tool for detecting changes in your code.

Mostly git-blame used to show which version and author last modified each line of the file. This is similar to checking the fileโ€™s development history.

+56
Jul 03 '15 at 9:15
source share

The git blame command is used to find out who / which commit is responsible for the latest changes made to the file. The author / commit of each line can also be seen.

git blame filename (accepts responsibility for changes for all lines in the code)

git blame filename -L 0,10 (fixes responsibility for changes from line "0" to line "10")

There are many other options for the prosecution, as a rule, they can help.

+20
Mar 07 '18 at 5:22
source share

The git blame command comments on the line with the information from the revision that last modified the line, and ... with Git 2.22 (Q2 2019) it will do it faster due to a performance fix around " git blame ", especially in linear history (which is normal for which we must optimize).

See Commit f892014 (April 02, 2019) by David Kastrup ( fedelibre ) .
(Combined Junio โ€‹โ€‹C Hamano - gitster - in commit 4d8c4da , April 25, 2019)

blame.c : don't drop blame.c blobs

When the parent blob already has chunks queued for the charge, deleting the blob at the end of one step of the charge will immediately reboot it, doubling the number of I / O operations and unpacking the linear history during processing.

Keeping such parent blobs in memory seems like a reasonable optimization that should cause additional memory pressure, mainly when processing merges from old branches.

0
Apr 27 '19 at 21:26
source share



All Articles