git - 更改 bitbucket 中的主要分支?

标签 git bitbucket

我搞砸了,将一个分支推送到 bitbucket,这不是主分支。

enter image description here

我无法创建新的存储库,而且我对这个存储库的访问权限有限。我尝试重命名它。我最终删除了 .git 文件夹,现在我无法推送或 pull 该分支。当我试图 pull 它说:

(files)...
Please move or remove them before you can merge.
Aborting

我想要一个名为 main 的分支(作为主要分支),然后是从它分支出来的 cms-fe。

有人能帮我摆脱困境吗?

最佳答案

I want to have branch named main (as the main branch) and then cms-fe that branches out from it.

由于您没有管理员权限,我们将不得不重命名您的分支,而不是使用新名称推送它:

# rename the local branch
git branch -m cms-fe main

现在分支有了新名称,我们将把新名称推送到远程

git push origin main

现在我们将删除您使用旧名称推送的旧分支

git push origin :cms-fe

从主干分支出来

git checkout main
git checkout -b cms-fe

# upload the branch to the remote server
git push origin cms-fe

关于git - 更改 bitbucket 中的主要分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41890107/

相关文章:

git - jenkins 子模块基于 git commit 构建

git - 如何将 "time travel"git 存储库重新修订?

git - Jmeter 和 Bitbucket 服务器负载测试

git - SourceTree 不断询问 Github 密码

git - 在 Git 预提交 Hook 中聚合和丑化 JavaScript

swift - Xcode 6.3 中的 Git : Master branch showing new files from other branches in red and won't compile

java - 使用 Hawtio 时的 org.eclipse.jgit.errors.LockFailedException

git - 是否可以从存储中应用单行?

ios - Cocoapods - 指定源 repo 用户名

git - 通过 pull 请求解决 merge 冲突