Make Selenium Easy

Git Tutorial 13 – What Is A Branch In Git?

Introduction

As a part of GIT Tutorials End To End, we will learn about branching concepts of Git in this post.

Prerequisite posts

I will expect that you are aware of the basic concepts and commands of GIT. But if you are a beginner in GIT then I strongly recommend you to refer GIT Basic Commands and Concepts section on my blog first.

Did you know that I have started a YouTube channel as well and I need your support to make it successful. Please do watch content then comment, like, share, and obviously subscribe.

Why Branch?

Let’s visualize some scenarios which might help you to understand the necessity of branches.

You are a hardworking developer and asked to develop two features in a Sprint. You started writing code for the first feature by pulling the latest code from the master branch in your local repo. During development, you found a requirement gap and can’t continue development. Meanwhile, you would like to start coding for the second feature but you have incomplete/unstable code for the first feature in your local repo. You have multiple options here:-

  • Delete all code of first Feature.
  • Make a copy of all changes in different folder and then start working on second feature.
  • You can pull change from master again in a new local repo.

There might be many more and seriously I have used the above options when I was a beginner in git.

The best option for the above scenario will be Branching. You can save the incomplete code of the first feature in a branch and can continue developing the second feature in another branch. You can work on both features parallelly and independently. You can perform all git operations in branches. A branch can be created in multiple scenarios like a bug fix, feature development, experimental code or customized code for different environments etc.

Advantages of branches in Git

  • Parallel development of features independently. Codes can be reviewd and modified easily.
  • Feature developed in a branch can be merged easily to main branch.
  • Useful in quick bg fixes, experimeting codes etc.
  • Code from any branch can be pulled and pushed.

In fact in real-time “Branch” system is mostly used. For example – In a sprint-based development methodology, features are developed in individual branches by each developer and merged to the main branch after proper review. We will see more about branches in upcoming posts.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe to my YouTube channel.
#ThanksForReading
#HappyLearning

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.

Git Tutorial 13 – What Is A Branch In Git?

by Amod Mahajan time to read: 2 min
0
%d bloggers like this: