Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSTFS 2015: Unable to delete remote branch

I have a setup of VSTFS that is 2015 with git. Somehow we have two branches, Development which is one I want to keep isolated since that is our master. Somehow there is a remote branch development (lower case d) as well. I want to delete this one since it is confusing, but I'm afraid to do so in case we get into issues.

enter image description here

My problem is, I'm running VS 2017 and it won't delete the remote branch. I did this by right clicking in team explorer and clicking "delete".

enter image description here

The message from the output window says the following:

Error encountered while deleting branch from the remote repository: Git process failed unexpectedly. PushCommand.ExecutePushCommand

So, I open up a cli and see what's there. The command here would be to do

git branch -d -r origin/<branchname>

However, I tried it on another throw away branch, and I'm still able to see it in the TFS listing in the browser.

My question is, how do I delete lower case development to make sure that I don't delete uppercase development?

UPDATE:

Seems that I am missing ForcePush permissions on our git instance, despite being a TFS administrator. Currently determining if this is the cause of the issue.

like image 575
Kat Avatar asked Oct 12 '17 14:10

Kat


1 Answers

Update 2: There's a great executive summary for how to delete remote branches provided in this previous stackoverflow answer. One thing that's left out I think is that in order to execute the command $ git push -d <remote_name> <branch_name> you'll need permissions to "force-push" to the branch.

Update: This may be a problem with git's case insensitivity. See the blog post here: https://tosbourn.com/git-branches-seem-to-be-case-insensitive/

Original Answer:
I think git push origin :development will do it. You can think of this as "push null to development" -- in other words, delete the branch.

I believe when you execute git branch -d -r origin/<branch name> you are only removing your remote tracking branch, which is stored locally.

like image 136
Michael W. Avatar answered Sep 28 '22 08:09

Michael W.