【问题标题】:How to remove the git remote master from bitbucket? [duplicate]如何从 bitbucket 中删除 git 远程主机? [复制]
【发布时间】:2015-11-15 02:56:53
【问题描述】:

在一个 git 项目中,我在一个分支中做了一些重构,现在这个分支应该是一个新项目。 我把这个项目从 github 移到了 bitbucket。现在我想删除旧的master,让重构分支成为新的master。

我试图删除主人:

$ git branch -D master
Deleted branch master (was a947288).
$ git push origin :master
remote: error: refusing to delete the current branch: refs/heads/master
 ! [remote rejected] master (deletion of the current branch prohibited)

在 bitbucket 前端,我也无法删除 master。那我怎么能做到呢?还是我必须创建一个新项目并将重构分支推送到它的 master 中?

【问题讨论】:

  • @Jude 在 GUI 中学习 Git 是灾难的秘诀(个人观点)。

标签: git bitbucket


【解决方案1】:

您必须先更改 bibucket 的主分支,然后才能删除它。 只要master 是主分支,bitbucket 就会阻止你这样做(这是有道理的)。

在 Bitbucket 用户界面中:

  • 选择存储库
  • 选择管理
  • 在 Repository Details 中,设置 Main 分支

重复:

【讨论】:

    【解决方案2】:

    当您将删除推送到您的新分支时,you must first change the default branch (on GitHub)
    这意味着您必须先将新分支推送到 GitHub 上才能将其选为默认分支。

    然后就可以在GitHub上删除master了。

    同样的想法applies on BitBucket:

    1. 选择存储库
    2. 选择管理
    3. 在 Repository Details 中,设置 Main 分支

    【讨论】:

      猜你喜欢
      • 2013-09-22
      • 2011-05-08
      • 2020-02-13
      • 2016-07-06
      • 2020-11-18
      • 2015-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多