删除github分支

时间:2012-10-08 19:09:28

标签: git github branch

  

可能重复:
  How do I delete a Git branch both locally and in Github?

首先,我阅读了如何删除分支,但由于某种原因,我的项目无效:https://github.com/ralcr/sdk.ralcr

当您第一次进入此处时,您会在gh-pages分支中看到10个月前的一些文件。我不知道这个分支是如何创建的以及为什么它首先显示,但我想删除它并且这不起作用

Balutas-MacBook-Pro:sdk.ralcr Cristi$ git push origin --delete gh-pages
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

我只想要主分支。

3 个答案:

答案 0 :(得分:4)

我在这里找到了解决方案:https://github.com/matthew-brett/pydagogue/blob/master/gh_delete_master.rst 我无法删除分支,因为它是默认分支。要更改它,请转到管理员,然后有一个下拉列表。

答案 1 :(得分:2)

尝试使用git branch -d <feature-branch>,可以删除功能分支。

(尽管通常git merge <branch-name>在此之前被调用以在删除之前合并分支)

删除远程分支:

git push origin :<feature-branch>

答案 2 :(得分:2)

要删除远程分支,您必须这样做:

git push <remote> :<branch>
# example
git push origin :gh-pages

但在你的情况下,起源似乎不是一个远程回购。您应该检查您的远程名称并使用好名称。

git remote

另外,请确保您的远程URL是可写的。使用git协议是只读的,因此您需要获取ssh协议。 (也应该使用https网址)