The Dos and Don'ts of Creating Good Git Commits
Tags: beginners, github, git, tutorial
Published: 2022-08-01 09:11:00

###The Importance of Good Git Commits
There are several reasons why good commits are important. First, commits are used to track changes to a project. This is especially important when working on a team, as it allows everyone to see what changes have been made and who made them. Good commits should be clear and concise so that they are easy to understand. Second, commits should be atomic, meaning that each commit should only contain one change. This makes it easier to revert changes if necessary. Finally, good commits should be made regularly so that the project history is easy to follow.

###The Dos of Creating Good Git Commits
1. Write clear, concise, and meaningful commit messages. This means that your commit message should be able to stand on its own and explain what changes were made in the commit. A good commit message should also be descriptive enough that someone looking through the commit history will be able to understand what happened in each commit.
2. Group related changes together in a single commit. This will help keep your commits small and manageable. It also makes it easier to revert changes if necessary, since you can simply revert a single commit instead of having to revert multiple commits.
3. Test your changes before committing them. This helps ensure that your changes actually work and don’t introduce any new bugs. It also allows you to catch any potential problems early on so that they can be fixed before they cause more serious issues.
4. Make sure your commits are atomic. This means that each commit should contain a single, self-contained change. This makes it easier to revert individual changes if necessary, and it also helps keep your commits small and manageable.
5. Use Git’s interactive rebase feature to squash commits and clean up your commit history. This allows you to combine multiple small commits into a single larger commit, which can make your commit history much cleaner and easier to understand.

###The Don'ts of Creating Good Git Commits
1. Make sure you're not committing any secrets. A secret is something that should not be publicly available, like authorization credentials (usernames, passwords, tokens, API keys etc.), environment variables or anything else you don't want other people to have access to.
2. Make sure you don't commit any unwanted files, like OS specific files (e.g Thumbs.db on Windows and .DS_Store on macOS), or any IDE specific files (e.g .vscode on Visual Studio Code).

So, in summary, remember to keep your commit messages clear, concise, and meaningful. And avoid making unnecessary commits just for the sake of “bumping” the history. By following these simple guidelines, you can ensure that your Git commits are helpful and informative for both yourself and others.

Assuming you followed the dos and avoided the don'ts, you should now have good GitHub commits! Don't worry about doint all of these things right away, these are just recommendations and best-practices that may help you and your team, not strict rules or requirements.
Thanks for reading and good luck!

Star our [Github repo](https://bit.ly/3QFgAUf) and join the discussion in our [Discord channel](https://bit.ly/3HQtlYo) to help us make the BLST website the best it can be!
Test your API for free now at [BLST](https://www.blstsecurity.com/?promo=blst&domain=https://dev.to/The_Dos_and_Donts_of_Creating_Good_Github_Commits)!