Git : delete remote branch

January 26th, 2013 § 0 comments

Delete local branch

Deleting a local git branch is easy, using options `-d` or `-D` will do it. Its is always safe to use `-d` option because it won’t allow us to delete unmerged branch, where as `-D` will delete the unmerged branch without any warning or notification.

git branch -d branch_name_to_delete

But this will delete only branch in our local system.

Delete remote branch

So how can we delete a remote branch? Any way none of the option for git branch won’t delete it. Remote branch can only deleted by using git push command.

 git push origin :branch_name_to_delete

You have to notice the full-colon (:) prefixed to the branch name. The prefixed colon is the one asking git to do the trick.

Thanks.

Revath S Kumar [RSK]

- Rubyist / JavaScripter - Yeoman Team member - Open source enthusiast - Blogger @ PHPRepo and http://blog.revathskumar.com - Coder @ Whatznear - Google fanboy - jQuery lover

More Posts - Website - Twitter - Facebook - LinkedIn - Pinterest - Google Plus - YouTube

Tagged