Creating and Managing Branches in GitHub

sangeetha arun
3 min readMay 10, 2024

--

Branching in Git is a useful feature for software developers working on a large-scale project. It enables team members to collaborate on different aspects of the software by creating a branch from the main branch. The changes in the created branch do not affect the main branch until they are merged into it. Once the branch’s work is completed, it can be merged into the main branch to incorporate the changes. It allows for better management of software-related files. It also allows us to try or experiment with adding new features to the code; if successful, it can be merged with the main code in the main branch.

In this article, we will learn how to create a new branch in Git and push the code to it.

Prerequisite

Need account in GitHub

To Create a New Git Branch

It will simply create a new git branch with the custom name. This branch allows you to push and pull code from the remote repository and make changes based on your needs. To create a new git branch, use the following command.

git branch <Branch name>

Now, let’s create a branch in the GUI for that GitHub login. Navigate to the repository where you wish to create the branch. In this example, I have a Dev repository with two branches: main and master. I now want to create a UAT branch in the same repository. Let us now do it.

Click on the branches tab and select new branch to create the branch.

Now the UAT branch has been created successfully.

To delete a branch in GitHub

Navigate to branch tab and you can see all the branches created for the repoistory.

Now the branch has been created successfully.

I hope this was helpful. Thank you for taking the time to read this.

I’m filled with joy to present this article, eager to ignite your curiosity with fresh insights. Let your applause resonate by clicking that heartfelt 👏 button below, a gesture that means the world to us.

--

--