How to remove a branch from github?

I saw previous posts asking about this, but no one solved it for me. I do not use Git through the command line, I use it because it is integrated into Xcode. I created a branch and clicked it on GitHub, and now I want to delete it. I deleted it in Xcode, but it is still on GitHub. The GitHub manuals say that just go to Admin and delete the repo, but it says that it will delete the whole project, not just the branch. So what am I missing?

+8
github
source share
1 answer

Do you want to delete a branch on github? Just do

$ git push origin :branch-name 

where you need to substitute origin name of the remote repository and branch-name with the name of the branch you want to delete in github.

Edit: Note the colon before the branch name, this is important.

Edit 2: To be more detailed:

 $ cd /path/to/local/git/checkout $ git remote -v show 

Select the remote name from the first column that matches the github url where you want to remove the branch. I call it origin here. branch-name - the name of the branch you want to delete. Delete it using:

 $ git push origin :branch-name 

Edit 3: If you want to know about git, I can recommend Scott Chacon's free book. The relevant section is here .

+15
source share

All Articles