Some git handy dandys

Deleting a Branch on the Origin Server Without GUI Interface

Updates and Metadata

Update your local with metadata of what’s on origin. Won’t mutate your branches.

git fetch

See what branches are stored on the origin git server

git branch -a # shows local and remote branches
git branch -r # shows remote branches

Branch Management

We want to delete a branch on origin. The command we’re headed for:

git push origin :<branch-name>

Let’s start with this command:

git push origin <my-branch-name>

What’s going on is your local git server is seeing that you have a branch and pushing it to a branch of the same name on the origin git server. In essence, it’s a shortcut for:

git push origin <my-local-branch-name>:<my-origin-branch-name>

This comes in handy when you’re wanting to do some work on different branches on your local and push it to a branch that already has some (compatible) history on it but just so happens to have a different name. Back to the point, what you’re doing when you execute our delete command is you are pushing a non-branch, if we can call it that, to an existing branch on the origin git server, which the server interprets as a delete.

git push origin :<my-origin-branch-name>

Presto change-o, you’ve deleted a branch.