Chad - that's totally bizarre...  based on the tutorials and cheat sheet I
have, you remove a branch form a repo with the following:

`git branch -d $branch`

There is a pretty active git channel on irc.freenode.org - I asked about
this and here's the explanation I got.

`git push` is the only command that can make changes to a remote repository.


It creates and updates branches - and it has been overloaded to delete
branches (since it's the only outgoing communication command).

Apparently the key to that github link is the colon.  If you know that `git
push origin foo` is really shorthand for `git push origin foo:foo` (because
usually the local branch and remote branch have the same name).  So when you
say:

git push origin :somebranch

You're pushing nothing to somebranch.


Below is the transcipt of the answer I got from spearce:


[21:43] <lenards> question - how do you remove a remote branch?  Is this
github link wrong: http://github.com/guides/remove-a-remote-branch
[21:43] <spearce> lenards: that link is actually correct
[21:45] <lenards> spearce: I don't understand why it works... why would `git
push` be how you remove a remote branch?
[21:45] <spearce> lenards: git push is the only command that can make
changes to a remote repository.  it can create branches, update branches,
and it was overloaded to delete branches, since its the only outgoing
communication command.
[21:47] <lenards> spearce: thank you... okay - but the syntax shown looks
like the same way I'd push changes to that remote branch
[21:49] <spearce> lenards: if you look carefully at the syntax the source
side of the argument is empty (the stuff before the :).  we are technically
pushing _nothing_ to the remote branch to cause its deletion.
[21:51] <lenards> spearce: hmmm... okay so if I was pushing to a remote
branch to update it... how would it look? `git push origin
localbranch:remotebranch` ?
[21:51] <spearce> lenards: correct
[21:51] <spearce> and its common for localbranch and remotebranch to be the
same name, so "git push origin A" is an shorthand for "git push origin A:A"

Reply via email to