My Favorite Git Commit Message

My favourite commit message is simply two phrases.

I take advantage of model management – Git, for probably the most half – on a regular basis, even with little scripts nobody will ever have a look at moreover me, even once I in all probability need not. I similar to it. One thing about utilizing model management or supply code administration or no matter you wish to name it makes my coding course of smoother.

And I observed one thing attention-grabbing, committing code into some repository or one other virtually each single day for the final a number of years. I’ve one commit message I take advantage of again and again and over.

It is this: “code compress”

All decrease case, similar to that.

That is sort of a shorthand… I will clarify. Think about I’ve code that is already working. Has unit exams, in all probability (although perhaps not sufficient of them… one other matter). However it has unit exams that are passing, or perhaps it would not, as a result of the script is straightforward and I am simply testing manually.

So I’ve added the adjustments to the repo and dedicated already. It is dedicated in a (partially) working state.

Then, I make it higher.

What do I do? I rename variables, features and strategies, so it is extra readable (comprehensible) when myself or a teammate are modifying this 11 months later and do not keep in mind what was in our heads again then. I take 5 or 20 or 100 strains of code, and I simplify it. In order that it turns into two or seven or 35 strains. No matter I can lower out.

No new options. Zero progress on performance. I merely make the code extra readable, maintainable, or in any other case higher. It went from one working state, to a different, equal working state. A totally horizontal transfer.

After which I git-add and git-commit. With the message “code compress”.

Usually this makes the code base smaller, when it comes to lines-of-code. In a means that (importantly) is extra readable and maintainable. However nonetheless works simply as properly.

Extra elegant, in different phrases.

However not at all times. The precise change set would not *have* to cut back the strains of code. If I am altering the names of identifiers, that has mainly zero impact on the code dimension. Heck, I’ll take an obscure dozen strains and within the technique of de-obfuscating it, now it is one thing like 80, or 200. So I am not at all times truly compressing the code.

However regardless, it is an enchancment.

That is nice to do in your personal personal department, the place you can also make a zillion tiny commits and nobody offers you a tough time about it. Typically I will have three “code compress” commits in a row.

I do that so usually, so regularly, that I simply settled on the phrase “code compress” so I haven’t got to consider what message to write down. There’s in all probability a greater identify for it. However I can not be bothered to vary that behavior. That takes willpower, and I’ve different habits which might be extra necessary to vary.

However perhaps you get the concept.

What’s nice about this idea:

Simply figuring out you should utilize “code compress” as a commit message,

routinely will get you eager about how one can frequently IMPROVE

your code.

Attempt it in the present day. As a result of you’ll love the outcomes.

Posted By: Aaron Maxwell on https://ezinearticles.com/?My-Favourite-Git-Commit-Message&id=10427910


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *