I want to delete a branch both locally and remotely from a project on GitHub.
& gt; git branch -D feature / experiment & gt; Deleted branch feature / experiment (was 863225e).
Attempts to delete a branch on the server
& gt; git branch -d origin / feature / experiment error: branch 'origin / feature / experiment' not found. & gt; git branch -rd origin / feature / experiment Deleted remote branch origin / feature / experiment (was 863225e). & gt; git pull * [new branch] feature / experiment - & gt; origin / feature / experiment
It’s not clear what “Deleted remote branch” means if the branch has not actually been deleted? The subsequent
pull command shows this.
What do I need to do to remove a branch both locally and on the server?
Answer 1, authority 100%
In Git v1.7.0, you can delete a remote branch using
git push origin --delete & lt; branchName & gt;
which is easier to remember than
git push origin: & lt; branchName & gt;
added in Git v1.5.0 “to remove a remote branch or tag”.
Answer 2, authority 7%
You can delete a branch in the remote repository like this:
git push origin: feature / experiment
-rd doesn’t work because it only removes the local remote-tracking branch. If the corresponding branch has not been removed from the remote repository, the remote-tracking branch will be recreated the next time the
fetch command is invoked.