DEV Community

Cover image for Git blame should be called git credit
Damien Cosset
Damien Cosset

Posted on • Originally published at damiencosset.com

Git blame should be called git credit

Positive language

Language is important, really important. How we express our ideas and our desires has a big impact on how our words will be received. Positive statements get more quickly received by the audience, but they are also well-received.

Which of these would you like to hear better?

  • Please don't be late at the restaurant tonight.
  • Please be on time at the restaurant tonight.

  • 66% chances you won't die, 33% chances you will die.

  • 66% chances it will save you, 33% chances you will be saved.

Well, in both cases I'd rather hear the second version of those statements. In the second set, it is known as the framing effect. You'll be more likely to choose the option with the positive connotations rather than the option with the negative ones.

git blame

Ok, back to our software things. The reason I got to think about this was because of git blame. Isn't it kind of strange that they went with a negative word such as blame for the command?

Here is the definition for blame:

feel or declare that (someone or something) is responsible for a fault or wrong.

responsibility for a fault or wrong.

Ew, that's not really joyful. But what's the point of the git blame command anyway?

According to the git documentation:

git-blame - Show what revision and author last modified each line of a file

So, git blame tells you who wrote what code in a specific file. But there are no mention that it's to find a fault or wrong doing. We just want to find who wrote some code!

Why go with negative language when we could have something positive?

Here comes credit!

Here is the definition for credit:

publicly acknowledge a contributor's role in the production of (something published or broadcast).

Well, that's a lot more positive! Maybe I want to find who wrote that code so I can congratulate her on such a beautifully crafted piece of engineering.

You know who wrote that 6 months ago?

You. You did. Give yourself some credit you rockstar ❤️

Aliasing

Turns out it's not that complicated if you are some weird person like me who likes to use positive language in your git commands. We can use some alias!

All you have to do is run this command:

git config --global alias.credit blame

Now, git credit does the same job as git blame!

It's a tiny tiny change. But it makes me feel happy to use positive language whenever I can 😄

Have fun ❤️

Latest comments (29)

Collapse
 
hybriscole profile image
Alberto Cole❌

this is like, late capitalism problems

Collapse
 
damcosset profile image
Damien Cosset

This is not a problem 😉

Collapse
 
nickgrim profile image
Nick Grimshaw

You can just use git annotate; it's a synonym for git blame with a slightly different output format, and it's been there for ever.

The advantage of this over custom aliases is that it'll be available on every system.

Collapse
 
damcosset profile image
Damien Cosset

Git annotate is nice, I didn't know about this. Thanks! And a nice neutral term as well 😄

Collapse
 
ryanmaffey profile image
Ryan Maffey

TL;DR: Use “blame” to find the person you’re looking for, but don’t personally blame/shame to them for what they did.

I agree with you that it’s really nice to encourage more positive thinking.

On the other hand, I believe that the notion of “blaming” should just be taken a bit tongue-in-cheek. I think that “blame” is actually a fairly accurate name for the way that I tend to use it. More often than not I’ll use it to figure out who wrote some potentially dodgy code; I am kind of looking for someone to blame! But there should be a focus on using the tool to find the person to “blame”, but it’s up to us not to place the blame on them (at least it without knowing the full story).

This is where I think it’s important that we are understanding towards each other and aim to help teach each other when we find room for improvement. If I find someone who’s written some dodgy code it doesn’t mean I’m going to tell them they did a bad job and caused a bunch of problems (i.e. blame/shame them for it). I don’t know the circumstances behind why that code exists. In my experience bad code is most commonly just due to time pressures. It would be super harsh of me to blame someone for making mistakes under pressure. The best thing to do is help them and make sure they understand why the code is an issue and help them see how they can solve and avoid these problems next time.

Collapse
 
damcosset profile image
Damien Cosset

Completely agree with you. Whatever language we use, it doesn't replace a talk with the developer who wrote the code to understand her thought process at the time. Time pressures or just simply lack of competence are often times the reason why the code is dodgy.

As several people mentioned in the comments already, even tough I like credit, I think a neutral word such as curious or annotate might even be better. It covers whatever use case you may have.

Collapse
 
ajnasz profile image
Lajos Koszti

Please, stop censoring everything. Git blame is perfectly fine.

Collapse
 
damcosset profile image
Damien Cosset

I'm not censoring anything. I have no power here 😂 I created a git alias. It's an opinion and we are just having a nice conversation.

Collapse
 
jessekphillips profile image
Jesse Phillips

It really isn't about the author, it is about the comment. The line of code was written (or removed) for a reason. Each commit comes with a comment, if you are good at reviewing merge requests you'll be looking for good comments on the code (issue number). This makes blame and bisect more helpful.

Don't blame the author, blame the client.

Collapse
 
jingxue profile image
Jing Xue

Well, usually our appreciation of well written code happens at levels well above a couple lines. The reality is if you are motivated enough to run a command and review its mundane output in order to pin point specifically who last changed a particular line of code, chances are it's because there is something wrong with that particular line of code, rather than because you appreciate how it's written, so...

That said, maybe some neutral term would be better, like git author.

Collapse
 
samuelfaure profile image
Samuel-Zacharie FAURE

I dislike the tendency to twist everything positively, therefore I'm not in favor of "git credit". I went with a neutral term instead : "git curious", because I'm just curious about what went there, I don't want to blame anyone for it.

Collapse
 
waynejwerner profile image
Wayne Werner

I feel similar. Though, I guess it also depends on my mood. Usually my mood is git butwhy. Sometimes it's git wtf. I think a few times it's been git ohcmon or git forcryingoutloud.

And sometimes it's just git whodunnit because this code is a mystery!

Collapse
 
siddharthshyniben profile image
Siddharth
git config --global alias.whodunnit "blame"
Enter fullscreen mode Exit fullscreen mode
Collapse
 
acelot profile image
acelot

It's hard to type. Git curois, git curouius, git curous :)

Collapse
 
damcosset profile image
Damien Cosset

Git curious is quite nice also 👍

Collapse
 
schmitzel76 profile image
Patrick Schmitz

Looking at other version control systems, the command was mostly called annotate, which actually also exist in git.

In subversion you have both blame and praise, which both are aliases for annotate

Collapse
 
bravemaster619 profile image
bravemaster619

We can rename git as "smart" - the second version lang. And then we can commit by typing smart commit and push by smart push. And "smart credit" fellow developers.

Collapse
 
bravemaster619 profile image
bravemaster619 • Edited

Well, git is made by you-know-who who prefers the "first" version. "Git" itself is the "first-version" lang XD.