Git

How to Delete a Branch on GitLab

While working with GitLab, users often create and use multiple branches in Git repositories for each development project module. It is an efficient way to work on different functionality while separating the new code. In some situations, users want to delete branches from GitLab. To do so, GitLab offers several tools through its web-based UI that enable developers to delete unprotected branches.

This tutorial will describe the process for deleting a branch on GitLab.

How to Delete a Branch on GitLab?

To delete a branch on GitLab manually, perform these steps:

  • Open the GitLab project.
  • Access the branch section and select a branch.
  • Click on the “Delete branch” option and confirm it by clicking on the “Yes, delete branch” button.

Step 1: Select GitLab Project

Initially, select the existing GitLab project from which you want to delete the branch. Here, we have selected the “Demo1” project:

Step 2: Access GitLab Branches

To access the GitLab branches tab, click on the “Branches” option:

Step 3: Select GitLab Branch

Next, select the branch which you want to delete, click on the below-highlighted vertical dots icon, and choose the “Delete branch” button:

Step 4: Delete Branch

Now, it will ask you for confirmation, and hit the “Yes, delete branch” button:

After deleting the branch, a pop-up message will be shown on your screen that represents that the selected branch has been deleted successfully:

Step 5: Verification

Lastly, you can verify whether the selected branch has been deleted or not by displaying the list of existing branches. According to the below-given screenshot, the particular branch has been deleted successfully:

That’s all! You have learned about the way of deleting branches on GitLab manually.

Conclusion

To delete a branch on GitLab manually, first, open the GitLab particular project from which you want to delete the branch, access the branch section, and select one of them. Then, hit the “Delete branch” option and confirm it by clicking on the “Yes, delete branch” button. This tutorial illustrated the method of deleting a branch on GitLab.

About the author

Maria Naz

I hold a master's degree in computer science. I am passionate about my work, exploring new technologies, learning programming languages, and I love to share my knowledge with the world.