Delete Branch From Remote Git Repo [Assembla]

Update: GitHub has an excellent tutorial on removing sensitive data from your GitHub repository.

We’ve just started using Git and Assembla at our office for version control and ticket tracking. Having never used any sort of version control before, this has been an interesting experience. It’s been a joy to work with so far, but there have definitely been some hurdles to overcome.

One issue we had was how to delete a branch that we had created that we no longer wanted to maintain. We had been playing around and had created several branches that we would not be maintaining. The important thing to remember is that both your local and remote repositories are two separate entities. So the branch must be deleted from all repositories to completely be rid of it.

Remote Branch

$ git push remotename :branchname

The key here being the colon preceding the branch name. The format being:

$ git push <repository> <refspec>

Where <refspec> is written:


Pushing an empty <src> allows you to delete the <dst> ref from the remote repository.

Local Branch

$ git branch -D branchname

I stumbled upon the solution in this Assembla forum post.

We’re also starting to accumulate a fair amount of information on our staff wiki. You’re welcome to take a look if you’re into that sort of thing.

One thought on “Delete Branch From Remote Git Repo [Assembla]

Comments are closed.