I saw previous posts asking about this, but none that solved it for me. I don't use Git through the command line, I use it as it's integrated into Xcode. I created a branch and pushed it to GitHub, and now I want to delete it. I deleted it in Xcode, but it's still on GitHub. The GitHub directions say to just go to Admin and delete the repo, but there it says it'll delete the whole project, not just the branch. So what am I missing?
Asked
Active
Viewed 5,194 times
10
-
Duplicate of http://stackoverflow.com/questions/4159950/how-do-i-delete-remote-branch-in-git – Celada Apr 25 '12 at 14:08
-
What's different about your situation from the other question? – Greg Bacon Apr 25 '12 at 20:26
1 Answers
16
You want to delete a branch on github? Just do
$ git push origin :branch-name
where you have to substitute origin
with the name of the remote repository and branch-name
with the name of the branch you want to delete at github.
Edit: Note the colon in front of the branch name, it is important.
Edit 2: To be more verbose:
$ cd /path/to/local/git/checkout
$ git remote -v show
Pick the remote name from the first column which corresponds to
the github URL where you want to delete the branch. I call it
origin
here. branch-name
is the name of the branch you want to delete. Delete it using:
$ git push origin :branch-name
Edit 3: If you want to learn about git, I can recommend the free book by Scott Chacon. The relevant section is here.

Michael Wild
- 24,977
- 3
- 43
- 43