Git: Can't delete remote branch permanently

You have to do this to remove the branch on the remote.

git push origin --delete new_branch

This will remove the branch called new_branch from the remote repository. (The new_branch is a local branch on the remote. To put it another way, if you could cd into the remote repository, making it the local repository, it would have a local branch called new_branch. That is the branch you are removing with the command above.)

When you do

git branch -r -d origin/new_branch

all that is happening is that you are removing the remote branch pointer that is in your local repository. This last command does not change anything in the remote repository.

After having removed the branch on the remote (using the first command above), then git remote prune origin will start working on your other computers, removing their remote branches origin/new_branch.

Tags:

Branch

Git