I created a bugfix branch to fix a bug on a project that I had forked on Github. I gave a pull request to the developer to incorporate my fix, but the developer decided to implement a different fix for the problem. At this point, I want to delete the bugfix branch both locally and on my project fork on Github.
Successfully Deleted Local Branch
$ git branch -D bugfix
Deleted branch bugfix (was 2a14ef7).
Attempts to Delete Remote Branch
$ git branch -d remotes/origin/bugfix
error: branch 'remotes/origin/bugfix' not found.
$ git branch -d origin/bugfix
error: branch 'origin/bugfix' not found.
$ git branch -rd origin/bugfix
Deleted remote branch origin/bugfix (was 2a14ef7).
$ git push
Everything up-to-date
$ git pull
From github.com:gituser/gitproject
* [new branch] bugfix -> origin/bugfix
Already up-to-date.
What do I need to do differently to successfully delete the branch remotes/origin/bugfix
both locally and on Github? Thanks.
Preliminary Research / Related StackOverflow Questions
- StackOverflow Question 1072171: How do you Remove an Invalid Remote Branch Reference from Git?
- Pro Git by Scott Chacon: Contains the answer along with the note "You may want to dog-ear this page, because you’ll need that command, and you’ll likely forget the syntax." Yep, that's me; I forgot the syntax. I'll post the answer in case others have this same question and for when I forget this syntax again. :-)