Removing wrongly created branch from Git

No votes yet
Your rating: None

If you accidentally fetched branch or branched local one and named it incorrectly (remotes/master instead of remotes/origin/master):

$ git branch -a
* master

You can't delete it using

$ git branch -d "remotes/master"
error: branch 'remotes/master' not found.

But you have to use

$ git branch -rd master
Deleted remote branch master (was d980b5e).
Keywords: Git, remove branch