Failed Attempts to Delete a 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.
How do I properly delete the remotes/origin/bugfix branch both locally and remotely?









Executive Summary
Note: In most cases,
<remote_name>will beorigin.Delete Local Branch
To delete the local branch, use one of the following:
-doption is an alias for--delete, which only deletes the branch if it has already been fully merged in its upstream branch.-Doption is an alias for--delete --force, which deletes the branch "irrespective of its merged status." [Source:man git-branch]git branch -d(delete) learned to honor the-f(force) flag.Delete Remote Branch
As of Git v1.7.0, you can delete a remote branch using
which might be easier to remember than
which was added in Git v1.5.0 "to delete a remote branch or a tag."
Starting with Git v2.8.0, you can also use
git pushwith the-doption as an alias for--delete. Therefore, the version of Git you have installed will dictate whether you need to use the easier or harder syntax.Delete Remote Branch [Original Answer from 5-Jan-2010]
From Chapter 3 of Pro Git by Scott Chacon:
I ran
git push origin :bugfix, and it worked beautifully. Scott Chacon was right—I will want to dog-ear that page (or virtually dog ear-by answering this on Stack Overflow).Finally, execute the following on other machines to propagate changes: