David
David

Reputation: 36424

How to remove a git remote branch

So i've got something like this for a repository atm.

D-Hewards-MacBook-Pro:project dheward$ git branch -r
origin/master
unfuddle/master

Interestingly because it is the master branch of the unfuddle repo it will not let me delete it using command such as:-

git push unfuddle :master

One points to unfuddle and the other to another git repo. What I want to do is remove the unfuddle one from this repo and stop tracking it altogether.

Does anyone know what I can do to achieve this? Tried a few things to little avail.

SOLVED:

D-Hewards-MacBook-Pro:projectname dheward$ git branch -r -d unfuddle/master
Deleted remote branch unfuddle/master (was bb55c89).
D-Hewards-MacBook-Pro:projectname dheward$ git remote rm unfuddle
D-Hewards-MacBook-Pro:projectname dheward$ git branch -r origin/master

Upvotes: 3

Views: 1776

Answers (1)

Daniel Hershcovich
Daniel Hershcovich

Reputation: 3931

Assuming you just want to remove the remote-tracking branch from your repository, you could do

git branch -r -d unfuddle/master

You can also remove your pointer to the unfuddle repository altogether:

git remote rm unfuddle

If you actually want to remove the master branch from the repository that unfuddle points to (like your push command seems to attempt), you can only do that if master is not checked out there or if receive.denyDeleteCurrent is false there.

Upvotes: 4

Related Questions