How to Delete a branch in remote GitLab repository
In this tutorial, we are going to learn about how to delete a branch in remote GitLab repository.
Consider, that we have a git branch called work
in remote gitlab repository.To delete that branch follow the below tutorial.
To delete a branch in remote gitlab 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