ArchiveOld post. Originally published 30 July 2012 on the WordPress version of this site. Preserved here for the search engines and the curious. Old me had opinions.
Developer2 min read

Quick Tip: Delete Remote Git Branches

Not exactly a new thing, but one I have always had to Google for. In my workflow I normally create a new branch when working on a major feature change (this ensures if I have any bug fixes to do in the mean time I can work on them without having to muddle around code). It gets pushed to GitHub so my other developers can work on it as well. When it’s released I usually merge back into my develop branch and ultimately into my master branch. So deleting the local branch is easy, probably because I always Git Tower or the GitHub Mac App. How the hell do I delete this now defunct branch from GitHub?

git push <remote> :<branch_name>

On this occasion for me it was:

git push origin :2012

You learn something new everyday. I should have learnt this a long time ago but only started using Git after attending last year’s Cakefest!


Filed under Developer. No comments, on purpose.