How to Delete a branch in remote GitHub repository
In this tutorial, we are going to learn about how to delete a branch in remote GitHub repository.
Consider, that we have a git branch called work
in remote GitHub repository.To delete that branch follow the below tutorial.
To delete a branch in remote GitHub repository, we can use the git push
command followed by the remote-name , --delete
flag and branch name.
Here is an example:
# git push <remote-name> --delete <branch-name>
git push origin --delete work
Now, our work
branch is successfully deleted remotely.
Note: In most cases, remote-name is origin
.
Deleting Git branch Locally
To delete a git branch locally, we can use the git branch
command followed by the -d
flag and name of the branch.
Example:
# git branch -d <branch-name>
git branch -d work