Last Updated: February 25, 2016
·
593
· milesmatthias

Figure out who to blame with git

I learned two new git commands today, when I was trying to track down who added a bug into our project. I knew what the code was, and which file it was in, I just didn't know who added it.

git blame <path/to/file>

showed me a commit hashes and authors for every line within the file I gave it, which told me who was to blame.

I wanted to see what all was done in this commit so that I could see how we missed that bug. I copied the commit hash for that line and then used:

git show <commit hash>

to see the entire offending commit. Bulls-eye.

1 Response
Add your response

If you are using Emacs, vc-mode has a nice blame interface (vc-annotate) which I can highly recommend.

over 1 year ago ·