Discussing Code Commit in Projects

Discussing Code Commit in Projects

Daily short news for you
  • Privacy Guides is a non-profit project aimed at providing users with insights into privacy rights, while also recommending best practices or tools to help reclaim privacy in the world of the Internet.

    There are many great articles here, and I will take the example of three concepts that are often confused or misrepresented: Privacy, Security, and Anonymity. While many people who oppose privacy argue that a person does not need privacy if they have 'nothing to hide.' 'This is a dangerous misconception, as it creates the impression that those who demand privacy must be deviant, criminal, or wrongdoers.' - Why Privacy Matters.

    » Read more
  • There is a wonderful place to learn, or if you're stuck in the thought that there's nothing left to learn, then the comments over at Hacker News are just for you.

    Y Combinator - the company behind Hacker News focuses on venture capital investments for startups in Silicon Valley, so it’s no surprise that there are many brilliant minds commenting here. But their casual discussions provide us with keywords that can open up many new insights.

    Don't believe it? Just scroll a bit, click on a post that matches your interests, check out the comments, and don’t forget to grab a cup of coffee next to you ☕️

    » Read more
  • Just got played by my buddy Turso. The server suddenly crashed, and checking the logs revealed a lot of errors:

    Operation was blocked LibsqlError: PROXY_ERROR: error executing a request on the primary

    Suspicious, I went to the Turso admin panel and saw the statistics showing that I had executed over 500 million write commands!? At that moment, I was like, "What the heck? Am I being DDoSed? But there's no way I could have written 500 million."

    Turso offers users free monthly limits of 1 billion read requests and 25 million write requests, yet I had written over 500 million. Does that seem unreasonable to everyone? 😆. But the server was down, and should I really spend money to get it back online? Roughly calculating, 500M would cost about $500.

    After that, I went to the Discord channel seeking help, and very quickly someone came in to assist me, and just a few minutes later they informed me that the error was on their side and had restored the service for me. Truly, in the midst of misfortune, there’s good fortune; what I love most about this service is the quick support like this 🙏

    » Read more

Issues

Every day, we constantly code and fix bugs along with other team members. Suddenly, one fine day, the tester screams about an error that you had fixed weeks ago. You immediately speak up, stating that you had already fixed it and you need to prove it to the tester. You open the commit history and boom... commit, fix bug, fix some bug... are the things that hit your eyes. And guess what? Those are the commit messages you made!

Now, how do you find that specific commit? You torture yourself wondering why you didn't commit more clearly at that time. Don't worry, everyone makes mistakes, and mistakes are meant to be fixed. But what's more important is that you have to recognize that you made a mistake and share your method of improvement!

Commit Clearly

That's right, first and foremost, try to come up with clear messages that are action-oriented towards the target.

For example:

  • Fix the issue of missing names in the list of provinces/cities
  • Add the feature to update provinces/cities
  • Add the Reference Documentation section to README.MD

I'm using Vietnamese as an example, but depending on the project's rules, you can also commit in English, but the essence and content should remain the same.

Add prefixes to messages

This is a method that many developers have applied in various projects on the social network platform Github. By using prefixes to categorize your common commit types in the project, you can easily differentiate and search for them.

In general, there will be some prefixes that developers self-agree upon, but it's not necessary to follow them.

Some commonly used prefixes are:

  • feat: add a new feature
  • fix: fix a bug
  • refactor: optimize an existing feature
  • style: changes that do not affect the meaning of the previous code, often related to the code formatting such as missing semicolons (;), removing spaces...

There are many other prefixes as well, which you can refer to in this article How to Write Better Git Commit Messages – A Step-By-Step Guide.

For example:

  • fix: Fix the issue of missing names in the list of provinces/cities
  • feat: Add the feature to update provinces/cities
  • docs: Add the Reference Documentation section to README.MD

Try to separate the meaning of each commit

I understand that many of you (including me) often encounter situations where while working on one feature or fixing a specific bug, we suddenly discover another issue and fix it conveniently. Then, when it comes to commit, we only write a generic message like "fix some bugs". This may be convenient, but it complicates tracking. Therefore, try to fix them one by one in a clear manner. Don't be afraid of using multiple commits and commit clearly.

Apply Git Flow

Git flow is a term that refers to the "conventions" followed by a team in a project. For example, a project might have 3 branches: master to store the latest code, release to determine the production-ready features, and develop to develop features for release.

In addition, Git Flow also defines the branching and merging flow while developing features. There is a well-known Git Flow called Git-Flow Cheatsheet which developers can refer to.

Lastly, use GUI tools for management

If you are comfortable with the command-line interface, that's okay. But personally, there have been many times when I had to use tools for managing Git. I find it convenient and it helps me keep track of the project's flow.

Nowadays, almost all code editors integrate or have plugins that allow easy and convenient Git management. Developers can explore further based on the specific tools they are using.

In conclusion

The above sharing is based on my experience, and it is up to the developers to apply them depending on their team's work and project flow. If you find them not suitable or have better suggestions, please leave a comment and let me and others know!

Premium
Hello

Me & the desire to "play with words"

Have you tried writing? And then failed or not satisfied? At 2coffee.dev we have had a hard time with writing. Don't be discouraged, because now we have a way to help you. Click to become a member now!

Have you tried writing? And then failed or not satisfied? At 2coffee.dev we have had a hard time with writing. Don't be discouraged, because now we have a way to help you. Click to become a member now!

View all

Subscribe to receive new article notifications

or
* The summary newsletter is sent every 1-2 weeks, cancel anytime.

Comments (2)

Leave a comment...
Avatar
Trần Cường2 years ago
Thực sự mình không để ý đến cái này, mình chỉ commit theo lý do tại sao
Reply
Avatar
Linh Trần2 years ago
Giờ mình mới biết có commit theo
Reply