So! What is GIT?

Git is an open-source version control system that helps all project contributors keep their project artifacts. It facilitates the process of storing, viewing, and retrieving versions of files.

Through Git, developers can work together on a project through a shared repository. They can use it to store snapshots called commits of the project at different points in time. This allows developers to work on multiple versions of files simultaneously.

Git also simplifies collaboration by allowing you to share your projects with other people over the internet with bare minimum fuss.

Git is a very flexible tool. When you know how to work with Git commands, you are better at managing things. At the same time, if you are unsure or mismanaging, you may end with trouble.

Let us see ten usages that you should avoid in GIT

1. Master is Master

Master is a special branch in git. Usually, it contains a stable version of the application. Mostly we will build our end product from the master branch. Therefore we should not commit directly to the master branch. Committing our local works to the master branch leads to having a higher risk of corrupting changes, new bugs, and some extra working hours. Always create a fix-branch and commit all your works to that branch rather than committing directly to the master branch.

2. No Big Commits

So developers have a habit of making a single commit at the end of the day which includes all changes. Actually, they have worked on several features and bugs but only a single commit is going to cover the whole changes. We can have so many small commits rather than a big single commit.

3. Sshh! secrets are there

When you are developing you may have to create some private files such as API keys, Secret Keys, Database secrets, and many more.
Those are secrets.😶
Committing those keys into your branch will make your application vulnerable. It leads to some security issues in your application. So never push your secrets to the branch.

4. It is GIT, not your google drive

Git never restricts file size, But storing a large file that is not needed in your repository(Ex:- Demo videos) will make the person who clones wait for a long time. It is better not to store large files and binary files in GIT. There are a lot of services for those types of files.

5.Don’t ignore .gitignore

gitignore is another important file in your project which saves the repository. gitignore files are used to ignore specific files from the staging. To achieve this we have to mention the file name or pattern to the gitignore file. Always create a .gitignore file with file patterns and keep it at the root of the project.

6. Reset is not a solution always

As tech guys, we always reset our devices to solve the solution, and most of the time it works. But not in Git. When you are in trouble always think so many times before resetting the branch. Think before reset.

7. Hey! Don’t Force me

Do not perform force push until it is needed. It will cause a lot of trouble to other contributors in the same project. Always pull and then push to a branch.

8. History Says everything. (No time travel)

Have you ever thought about why are we typing some message when making commits? When you are making a commit to a branch, git saves it with that commit message. Those messages are saved with the history. So with that message, you can understand what are changes were happened to our codes. If you modified or delete the history it will make it hard to debug or find error points in your application. So no time travel.

9. No Amend

It is not a good practice to amend a commit. If you are sure with your progress then only you have to go with amend. Otherwise, no amending a commit.

10.No multi-fixing

During the development time, you may have to work on several bugs or features, and it is usual that working on multiple features or bugs. But we have to make sure a single branch only contains one bug or feature. Avoid working on a single branch for multiple issues.

So far we have discussed some common mistakes that happen during the development process. Avoid those things and save some hours. So you can spend it with your loved ones.

Happy Coding 😃😃😃

About the Author

You may also like these