Git best practices and tools

git best practices and tools

Git is one of the best things developed by Linus Torvalds a.k.a creator of Linux operating system. He created this tool to manage his code during the development of Linux and he later made it publicly available for everyone for free!

Here are some best practices for git users and some tools that we recommend to our readers.

Using .gitignore files

Git ignores those files which are mentioned in the .gitignore file. Always use this file to ignore certain files from your project.

For example if you’re working on .NET platform. Make sure you add .vs, .su and packages folder into your .gitignore file. These files are always recreated when a project is built first time so tracking these files is not necessary. Tracking these files will also increase your commit push time as there will be lots of things to upload on server.

On a node.js, react or react native application, your node_modules is by default added to .gitignore file.

Start with new git repository

We recommend that you always start your projects from day one with a git repository. Developers don’t always start tracking their projects from the beginning. They do it after some time. This increases code sharing time and earlier changes can not be tracked hence cannot be revert again.

Commit Smaller & Modular

Many a times developers forget to commit their code when a certain task is completed. They wait for the day end to commit all code together.

We have found it to be a bad practice and we recommend that you commit your code for each completed tasks separately. This way you will increase chances of code manageability and If in any case you need to revert changes, you can always roll back or merge commits from history.

Using cloud based repository system

We recommend that you use a cloud based git respiratory system. There are a lot of free repository systems. Bitbucket and Github are two biggest cloud based git repository management systems which are free for small teams completely.

You can make unlimited repositories, make unlimited changes and updates with no restrictions. You’re allowed up to 3 members per team on a project which is good enough for small teams.

Recommended Git Tools

If you’re an experienced git professional, command prompt (cmd) or terminal is the best thing for you.

But if you’re new git user, we recommend that you try Sourcetree. It is a completely free UI tool for git users to easily track their commits and manage their repositories. It can easily be setup with Github or Bitbucket.

Leave a Reply

Your email address will not be published. Required fields are marked *