Skip navigation

I’ve been using command-line git for about a year now. I recently decided to tackle my problem of not knowing how to delete remote branches.

I’ve pushed quite a few branches to some remote repos as a means of transporting projects to/from home/work. As a result there are quite a few useless branches in most of my git projects and it makes working with

git branch -a

more cumbersome than it need be.

In searching for an answer, I actually found out that it is much simpler than I had anticipated. Very similar to what I was already doing to push the branch to the remote repo.

git push origin :<branchname>

That’s it! I just have to add a colon to the remote branch name and git deletes it. Not at all intuitive, but very easy to remember.

%d bloggers like this: