The 3 merits of doing git commit frequently

Tomoharu Tsutsumi
2 min readAug 12, 2019

Many people tell me to do git commit frequently. I didn’t know why when I was told for the first time. However, I have known that recently. This is a thing that we can know by coding actually. I summarized 3 things of doing git commit frequently.

1. The code becomes easier to test

Our project has test code. Of course, so does your project. If your test code has errors, you must fix it. Sometimes, it is so difficult to solve them. In that case, some people want to know when the errors happened. If the range of git commit is broad, it is difficult to find the cause. Making the range small leads to your easy debug.

2. It becomes easier to review

When we review code in GitHub, It is to find what a code does if the range of commit is broad. Every code has its role as a part of a big function. I think each commit message should explain the role.

3. Coding becomes easier

When we focus on coding, sometimes we forget to do git commit. However, git commit frequently leads to your effective coding. Please look at the image below.

You must make a function. When you wrap up right codes, should you do git commit about right codes? Of course, yes. In that time, you has not begun to write the wrong codes. When you finish coding the right codes and the wrong codes, if you notice the codes are wrong, you want to undo the changes. If you don’t do git commit about the right codes, the right codes will undo too. It is a waste of time.

These 3 things are the merits of git commit frequently. Sometimes, we forget it, but we must have a habit of doing it.

If you think this article good, please follow me!

I update articles once a week!

https://twitter.com/tomoharutsutsum

--

--

Tomoharu Tsutsumi
Tomoharu Tsutsumi

Written by Tomoharu Tsutsumi

5+ years Full Stack SWE (Ruby, Go, TypeScript, JavaScript) | Former Founding Engineer of AI Startup in Canada

No responses yet