delete branches in the remote git repository

There are two methods to delete a branch in the remote git server. Either of these two commands is OK.

git push origin :BRANCH_TO_BE_DELETED

git push –delete origin BRANCH_TO_BE_DELETED

Please note the colon in the first command.

In order to verify the branch deletion, run the below commands in the local repository to delete the local and remote tracking branch:


git branch -D -r origin/BRANCH_TO_BE_DELETED

Then run the below command to make sure the deleted branch is no longer pulled from the remote repository

git pulll

git branch -r