Live data from Hacker News

Git-blame-someone-else

github.com

11–20 of 100 posts

Re: Git-blame-someone-else

#11
post #7

I runned a code formatter in our code base. Years later I was still 'blamed' for many things in our code as few files were untouched.

At one company I did a project that among other things involved bringing in a code formatter. I deliberately tagged that commit with a generic author :-)

Re: Git-blame-someone-else

#12
post #7

I runned a code formatter in our code base. Years later I was still 'blamed' for many things in our code as few files were untouched.

We recently converted our monolith codebase at work from windows-1252 encoding to UTF-8 and now the entire project looks like it was written by 1 guy

Re: Git-blame-someone-else

#16
post #7

I runned a code formatter in our code base. Years later I was still 'blamed' for many things in our code as few files were untouched.

You can fix this! Look into the "ignore revs" file option on git blame or the option: blame.ignoreRevsFile

https://git-scm.com/docs/git-blame#Documentation/git-blame.t...

Re: Git-blame-someone-else

#17
post #7

I runned a code formatter in our code base. Years later I was still 'blamed' for many things in our code as few files were untouched.

I think it's best to migrate to a preferred formatting slowly, versus touching everything at once. I've had open pull requests that I've started over due to aggressive reformatting like that. Between that and breaking tools like 'git blame', it can be painful.

Re: Git-blame-someone-else

#18
Stop using git blame to look up who authored code, it's not a useful tool. Use git log -S to search for changes to that line (then repeat with the previous version of that line, until you find the original author), and/or git log -L to track changes to a code block. Don't waste your time with git blame.

Re: Git-blame-someone-else

#19
post #7

I runned a code formatter in our code base. Years later I was still 'blamed' for many things in our code as few files were untouched.

That's common. Most tools like Magit make it easy to dig down through multiple layers of formats, renames, refactors and typo fixes to find the commit that actually introduced something.

It's usually called "blame previous revision".

Re: Git-blame-someone-else

#20

Stop using git blame to look up who authored code, it's not a useful tool. Use git log -S to search for changes to that line (then repeat with the previous version of that line, until you find the original author), and/or git log -L to track changes to a code block. Don't waste your time with git blame.

My editor (sublime text) has built in git blame support. It's literally right-click -> blame file, and it will put the author of every line in the margin.
Post reply on HN