The Magic Behind git reward

Written by kyleboss | Published 2017/06/23
Tech Story Tags: git | software-development | coding | management-and-leadership | software-engineering

TLDRvia the TL;DR App

It’s the day before code-freeze. You look at the JIRA board and realize you have two more tickets to complete this sprint. Eyes squinted, favorite caffeinated beverage by your side, you begin to hack away at those final two tickets. You are determined because when your boss asked (or stated in the form of a question) during the sprint planning meeting if you could handle all these magical points, you passively gave the affirmative nod & uttered “ya, it shouldn’t be too hard”. 🤷🏽

“Big mistake,” you think as you recall that moment. 🤦‍

You begin to type with haste. You create your specs first because they tell you TDD is the way and your just trying to be a responsible adult here. 👩‍🎓 Finally the specs pass and you create those MVCs. A few minor bumps here and there but you are slowly and surely making progress.

💩 hits the fan…

Then, all of a sudden, that moment hits you like a ton of bricks. You see something you have never seen before: The word ‘klass’ in the beautiful, hopefully typo-free codebase.

“What the…what is this?!” You exclaim, “Is this German?”

You Google ‘klass’ to see if it is indeed German and find out it’s not. 🕵️‍️ Like a good friend though, StackOverflow has your back. Actually, it’s just something the Ruby community does to say “I want to use the word ‘class’ here…but that’s a protected keyword. So I will just say ‘klass’.”

Mind. Blown. For a moment, amidst your keyboard-slamming, you find yourself in a state of bliss. 💆🏽

“Who wrote this?” You ponder to yourself. Naturally, you use the reward feature within Git to find out.

$ git reward app/model/ginger_bread_lady.rb> ab7e2b50 (BadAssBrian 2017–01–25) def class_methods(klass)> ab7e2b50 (BadAssBrian 2017–01–25) Object.const_get(klass).methods> ab7e2b50 (BadAssBrian 2017–01–25) end

Wow. Brian did it…You always knew he was crazy smart. Brian taught you something today, something you will take with you for the rest of your career.

Brian, I came across GingerBreadLady#class_methods today… what a genius thing to do — using ‘klass’ since ‘class’ is a protected keyword.

— Your E-Mail to Brian

`git reward` not working?🤦‍

I sometimes get the following error:

git: ‘reward’ is not a git command.

When I get this error, the following command typically works for me. Give it a shot:

$ git config alias.reward blame

Peace, love, & vinyl


Published by HackerNoon on 2017/06/23