Masked Man Masked Man - 2 months ago 9
Git Question

How to delete remote branch (e.g. Github) from command line?

I have a git repository in my local machine:

I add a new branch called

test
and add a few commits

Then I checkout to
master
branch and add commits to it.

So I use
git push --all github
and continue working on master.
After some time I decide to completely remove the
test
branch and use:
git branch -d test
and
git branch -r -d github/test
, but it only deletes the local branch used for tracking the actual
test
branch as git says:


Deleted remote-tracking branch github/buggy (was acc5a58).


I'm asking if there's a way to actually remove the
test
branch from github servers from command-line?

Answer

As with every git server:

$ git push github :<BRANCH_NAME>

or:

$ git push github --delete <BRANCH_NAME>

Example:

$ git push github --delete test