Subscribe to my newsletter and never miss my upcoming articles

Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows from Wikipedia

In this article, we are going to learn about git branches.

Branching in GIT enables developers to work on different components concurrently and huge thanks to GIT for simplifying the process.

Take a look into this short story.

Take for instance construction workers working to set up a house. Some workers will be laying the floor, some doing the walls, some preparing cement and some plastering. These all are done with the main intent of finishing up the house.

The same applies to developers, for easy and efficient collaboration between developer’s git branches are very handy.

In this article, we are going to look into and learn about.

  1. Creating a GIT branch.
  2. Deleting a GIT branch
  3. Switching between branches
  4. Committing changes to GIT branches

Creating a GIT branch

For us to create a branch from then master branch we can use the commands down below.

git branch <name of your branch here>

The first command will create a branch with the name provided after the branch

Or you can use the command

git checkout –b <name of your branch here>

This git command will nest the two commands. First, it will create a branch with the name specified and then it will switch to that branch automatically.

Remember not to include the < > signs or else GIT will through you an error.

Deleting A GIT branch.

We can delete a GIT branch either locally(within our system) or remote (GITHUB repository).

To delete a branch locally we use the command.

git –d <branch name to delete here>

To delete a remote branch we use the command below.

git –D <branch name to delete>

This will delete a branch regardless of its merge status. The –D command will harmoniously enforce --delete and *--force commands altogether.

To delete a remote branch (GITHUB Repository) we can use the command

git push origin –d <branch to be deleted>

This command will delete the remote branch from the repository.

Switching Between Branches

Switching between branches is quite easy. First, to see all the created branches within a given repository we can use the command.

git branch –a

It will list all the created branches within a given repository.

Committing Changes.

To commit changes to git we will use the command

git commit

This will open a VIM editor and you can give a little illustration concerning your commits Another shorthand for avoiding the VIM editor which is some pain in the slack for the first try is using the –m command flag.

This will commit the changes with the message provided within the curly brackets

git commitm “this is my initial commit


GIT is a very powerful version control software. Understanding and mastering it is very handy for software engineers and developers.

Thank you for reading this article if you found it helpful please share. Drop your comment down below and can’t wait to read your reaction to this article.

Thank you once again.

Until next time PEACE and STAY SAFE.

No Comments Yet