Create an Delete a Branch on Github Repository

Share this post

This post is part of the complete guide on Git and Github

On Github, you can easily create or delete branches from a Github Repository.

What Are Branches?

Branches are virtual environments that you can make changes within a container that does not impact the other branches.

Create a New Branch on Github

On a Github repository that you own, in the “Code” tab, click on the branch dropdown at the top left.

Subscribe to my Newsletter

Then, click on “View all branches”.

From that window, click on “New branch”.

Create a Branch on Github
Create a Branch on Github

Name the branch and select the Branch source.

If your repository is a Fork, select your fork or the original repository as the branch source.

Next, a comment saying “Branch <branch-name> will be created shortly

Below you see a comment saying “Your main branch isn’t protected”, that simply is a reminder to protect your default branches.

Going back to your code tab, you can see that the new branch was created.

Delete a Branch from Github

Again, back to the main page of your repository (“Code” tab), from the branches dropdown, click on the “View all branches” button.

From there, click on the garbage can next to the branch that you want to delete.

Delete Branch on Github
Delete Branch on Github

Come back to the main tab of your repository and check if the branch is still showing in the dropdown.

Restore a Deleted Branch on Github

To restore a deleted branch on Github, all you need to do is navigate the branches dropdown and click on “View all branches”.

Then, you can just as easily click on the “Restore” button next to your branch.


This is it, we now have learned how to create and delete branches on Github.

5/5 - (1 vote)