ItSolutionStuff.com

How to Delete a Branch form GitHub Repository?

By Hardik Savani • November 6, 2024
Git

In this tutorial we will go over the demonstration of how to delete a branch using git command. This article goes in detailed on git remove branch from local. This article will give you simple example of git remove branch from remote. This article goes in detailed on git remove branch from local only.

In this tutorial, we will use git branch command delete branch locally and remote in github repository. we will use git command to delete branch name into github. so let's follow below step to remove branch in git.

Clone Git Repository(Optional):

If you are new and you haven't create or clone github repository yet then you can follow bellow tutorial:

Github Create or Clone Git Repository.

Delete Branch using Git Command:

I will give you two commands to delete git branch from local and remote. let's see one by one command:

Delete Git Branch from Local:

Delete git branch from local means the branch will only remove on your local machine not on github repository. so it will stay on github repository.

Example:

git branch -d dev-change

You can see below layout:

Delete Git Branch from Remote:

Delete git branch from remote means the branch will only remove on github repository. so it will remove branch from github repository.

Example:

git push --delete origin dev-change

You can see below layout:

Output:

I hope it can help you...

Tags: Git
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Switch Branch using Git Command?

Read Now →

How to Create a New Branch on GitHub?

Read Now →

How to Clone Github Repository using Command Line?

Read Now →

How to Ignore Wildcard Files Name in Git using Gitignore?

Read Now →

How to Ignore Folder in Git using Gitignore?

Read Now →

How to Ignore File in Git using Gitignore?

Read Now →

How to Git Ignore Some Files Locally?

Read Now →

How to Clone a Git Repository into a Specific Folder?

Read Now →

How to Clone Laravel Project from Github on Server?

Read Now →

How to Generate and Add SSH Key in Gitlab?

Read Now →

How to Add Git Add Remote Origin on Bitbucket Repository?

Read Now →

Git - How to Find a Deleted File in Commit History?

Read Now →