SVN 到 Git 转换 - 分支未推送到 Bitbucket

SVN to Git conversion - branches not pushed to Bitbucket

我是 Git 的新手,在迁移我的 SVN 时遇到了一些问题。我能够正确地转换为在我的本地机器上看起来不错的 git 存储库。然而,当我将它推送到 bitbucket 时,我只看到我的分支的 master 和 none(我可以在我的本地 git. 上看到)

我看到了类似的东西。

在我的本地机器上:

$git branch -vva 
* master                                                               
  remotes/branch1
  remotes/branch2

Bitbucket 只显示这个母版,没有分支。

这些分支在某些时候基本上可以成为标签(大多数只是不再使用的代码的旧修订版。)但我希望它们仍然存在于 git 版本中。

如何轻松地将我在本地的内容推送到 bitbucket?

您在 Bitbucket 上看不到分支的可能原因有两个。

  1. 您的问题与 Firedrill: Recreate central git repository from developers clones, as 重复。
  2. 您尝试推送的存储库中有 远程跟踪分支

如果是后者,你应该知道Git只会将你的本地分支推送到远程而不是你的远程跟踪分支.

您的 本地分支机构 是 git 在您 运行

时打印的分支机构
git branch      # show only local branches

你的远程跟踪分支是你运行

时git打印的分支
git branch -r   # show only remote tracking branches

但是你 运行ning 向你展示了 localremote tracking 分支

git branch -a   # show both local and remote tracking branches

要使远程跟踪分支成为本地分支,您可以运行

git branch <local-branch-name> <remote-branch-name>

或者在你的具体例子中

git branch branch1 remotes/branch1

但是,我感觉你的存储库比你提到的要多,因为 remotes/branch1 并不是真正正确的分支名称约定......我这么说的原因是 remotes关键字比较特殊,用在refs/remotes/中,是所有远程跟踪分支.

的官方前缀

能否请您向我们提供 git branchgit branch -r 命令的输出(针对 public 论坛进行了适当编辑),并让我们知道您期望哪个分支 Git 推送到 Bitbucket?

编辑:来自@DanielMoss 的评论Atlassian SVN import process

Branches and tags are not imported into the new Git repository as you might expect. You won’t find any of your SVN branches in the git branch output, nor will you find any of your SVN tags in the git tag output. But, if you run git branch -r, you’ll find all of the branches and tags from your SVN repository. The git svn clone command imports your SVN branches as remote branches and imports your SVN tags as remote branches prefixed with tags/.