Reputation: 35
I have a requirement to update HEAD on remote to point to some other branch. so that i can delete the branch on remote. I am using repo.Network.Push(remote, ":refs/head/master") call to delete the master branch on remote. Is there a way in Libgit2Sharp to do this ?
Upvotes: 1
Views: 338
Reputation: 5277
That would delete the mater branch if the remote repository allows it, but most don't, as that is very rarely something you actually want to do.
Changing the active branch on a repository can only be done from the repository itself. Pushing won't help you here. You need to go to the repository on the server and change the current branch, or use whatever administrative interface you have on the server to do it. On the command-line, it'd be something like
git symbolic-ref -m "Switch active branch" HEAD refs/heads/some-other-branch
But if all you want to do is remove the master branch on the server and make it unborn
git update-ref -d refs/heads/master
would get you there.
Upvotes: 1