Open In App

How To Delete Remote Branch in Git?

Last Updated : 03 Jun, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Git is an important tool in the process of application development and is used widely in the software industry by developers to maintain the codebase. Using this developers are able to organize their codebase and manage the version history of their project.

Now, as a developer, you need to know how to delete a Git branch because it will lead to a better productivity approach, and for that, we have discussed ways to delete Git branches. In this article, I’ll guide you through the entire process of deleting a git remote branch.

Steps to Delete Remote Branch in Git:

Step 1: To see all the branches, write this command in your terminal

git branch
gtb
Screenshot-(291)


Step 2: To completely remove a remote branch, you need to use the git push origin command with a -d flag, then specify the name of the remote branch.The command is as follow:

git push origin -d branch-name

For example: to remove the new_branch branch, I will run git push origin –d new_branch:

git push origin –d new_branch
Screenshot-(292)
How To Delete Remote Branch in Git?

You can see the remote branch, new_branch, is not listed anymore. If you check GitHub again, it won’t be there:

Screenshot-(293)

Next Article
Article Tags :

Similar Reads