How to delete a branch from a remote repository in Git?

Published January 3, 2021

In the last post we discussed how to delete a branch locally in Git?.

To delete a branch from a remote repository in Git first, you need to delete the branch name from local using the command

git branch -D <YOUR_BRANCH_NAME>

After that you need to push those changes to the remote repository and also by passing the --delete flag to delete the branch from the remote repository.

It can be done like this,

git push origin --delete <YOUR_BRANCH_NAME>

That's it. 😃

Feel free to share if you found this useful 😃.


Share on: Facebook Twitter