What is Git Messages ?
Git messages are brief descriptions of changes made to code that are saved in version control systems like Git. These messages play a crucial role in software development as they serve as a historical record of the changes made to a codebase, helping developers understand what changes were made, why they were made, and by whom. Clear and concise Git messages can also improve project management and team collaboration by providing a shared understanding of the codebase and making it easier to track issues and resolve conflicts.
So you might be wondering why this message is so important and why this plays a major role in software development.
Git messages matter because they provide a historical record of changes to a codebase, which can improve collaboration, code review, and troubleshooting.
How Can You Improve ?
Assuming you are about to develop a feature and there are multiple sections where there will be changes. Make separate commits for each section of implementation with suffix in message [1/N] and prefix as [SECTION] . Where N will be the total number of commits u will be doing for a particular implementation.
Example : Suppose u want to build a login page.
Redux state : [REDUX] : Login State Management [1/3]
Login Page : [LOGIN] : Login Page Implementation [2/3]
Routing : [ROUTING] : Routing Changes for Login Page [3/3]
Future Commit in login pages can show as : [LOGIN] : Change Form Handler
If you are using tickets like jira so we can simply modify the commit message as
[1282-REDUX] : Login State Management [1/3]
Why This ?
This can help with troubleshooting and tracking the implementation quicker and help the team understand without even opening the tickets.
Lets see why this can be a game changer
Suppose you want to use a similar login page for other projects now with this you know which all commits are needed and how many commits are needed and now you can just cherry-pick it and update as per needs.
How can this help in Troubleshooting ?
If something goes wrong in any section we can simply search the commit with those section tags and easily determine the root cause.
Example :
Suppose after the new release the routing is messed up so with this you immediately can look up the routing tags and see in git commit messages.
What’s Wrong With the Traditional Way ?
Now with this, you guys might think we can simply make a simple commit like [1282]: login page implementation With this Now suppose the worst case scenario is there might be a simple mistake that might break other sections with this implementation and simultaneously increase the number of efforts needed to troubleshoot what caused this when thousands of developers are working on the same code.
Importance of tags and Version update commit message
Git tags can help releases in an easy way also the commit message as simple as v1.0.20 can simply tell this is a version upgrade.
Why is this important ?
Suppose you have a version v1.0.20 and the application was working fine and now we decided to release v1.0.21 but now the application is crashing and since we don’t know the root cause for this we can simply down-merge the code. And later on, we can look at the commits between the versions and can reduce the troubleshooting time. Now u might be thinking why down merge instead of fixing and releasing on a day 0 basis now this completely depends on the availability of the Developers and QA and the time required to test the functionality completely. Since crashes can make a huge loss of trust in a customer/client and frequent incidents can cause eventually losing a customer.
What’s Wrong with the traditional way of doing it ?
Suppose you are committing the standard way of “version upgrade” with no mention of the version in the commit message now this can create confusion on where and what was the last working stage unless you open the changes in the commit.
