deleting remote branch does not remove from GitHub

I have a local branch, say hotfix. I put it up on GitHub using

$ git push -u origin hotfix

Then after merging the branch, I want to delete it. So I type

  • creating git branch after the fact?
  • egit: changes made in one branch are visible on another branch without any commit
  • How do you get the git branch name for a given shasum?
  • git: checkout files from another branch into current branch (don't switch HEAD to the other branch)
  • Workflow for multiple SVN branches in IntelliJ IDEA
  • Is there one git command to create a branch, switch to it, and link it to it's remote counterpart?
  • $ git branch -d hotfix
    

    which deletes the branch locally. However, the remote branch is still on GitHub. Of course when I look at my remote branches,

    $ git branch -r
      origin/HEAD -> origin/master
      origin/hotfix
      origin/master
    

    hotfix is still there. So then I try

    $ git branch -r -d origin/hotfix
    $ git branch -r
      origin/HEAD -> origin/master
      origin/master
    

    and hotfix is gone, as expected.

    But then I go to GitHub and look at my branches, and hotfix is still there! How can I delete the remote hotfix from GitHub via the command line, without having to navigate to GitHub in my browser and delete it using the Website UI?

  • how do I deploy multiple branches to different directories via git push?
  • Git Commit during Git Rebase - what really happens?
  • Configure Jenkins to use GIT On Windows, Got stderr: Permission denied (publickey)
  • How do I force git NOT to prompt for credentials
  • Git Partial Fork, synced pull/merge
  • What scripts/calls do you usually include in your Git pre-commit hooks?
  • One Solution collect form web for “deleting remote branch does not remove from GitHub”

    You need to push that deletion:

    git push origin --delete hotfix
    

    (any git branch command would only have an effect on your local repo, not the GitHub remote one)

    See more at “How to delete a Git branch both locally and remotely?”.

    A git branch -d -r only deletes a remote tracking branch, that is branches existing in the remotes/origin namespace of your local repo. GitHub (the actual remote repo) is never notified.

    What you have “successfully” deleted is the “remote tracking branch” which is in your local repo and is meant to record the last SHA1 that you fetched from the upstream repo for that branch: that what a “remote tracking branch” is.

    The correct sequence is:

    git push origin --delete hotfix
    git remote update --prune origin
    

    That will delete the hotfix branch on the GitHub repo, and then delete any obsolete remote tracking branch in your repo.

    Git Baby is a git and github fan, let's start git clone.