Tuesday, 15 January 2013

How to delete remote branch in Git

Suppose if you are planning to delete remote branch do the following command might be very useful

git push origin :future_enhancement (Here future_enhancement is my remote branch name)

Note: If you are planning to remote master branch in git repository, might be faced some difficulties while deleting because of master branch is made it as "DEFAULT BRANCH".

Better come out from your master branch, just create any temporary branch/ if you have any other branch switch into that branch. Goto your github.com loggin with your credentials

Click =>"Account settings" link on top right corner on the github.com than Click =>"Repositories" tab from the left side menu than select your repository, there you can see "DEFAULT BRANCH" dropdown from there you have to select some other branches as default than save. Thats it from github.com.

Than you come to your local machine, now try to run the following command,

git push origin:master (Now master branch is deleted from the remote repository).

No comments :

Post a Comment