Bitbucket:将分支复制到现有的存储库

4

我在Bitbucket上有一个空的仓库B,想将另一个仓库A fork到我现有的仓库B中。我该如何操作?在Bitbucket网站上只允许fork到新的仓库。


2
为什么不直接删除Repo B并分叉出一个新Repo并将其命名为Repo B的名称?如果Repo B为空,则删除它无关紧要。除非你的问题还有更多其他的问题... - Harmelodic
因为B仓库的wiki已经有很多信息了,而我的任务是尝试使用它来进行分叉...这真让人沮丧。 - BoJIHa npocmombI
@Chris,我刚创建了一个新的仓库。 - BoJIHa npocmombI
1个回答

3
我看到两个选项:
  1. If you don't need Bitbucket to call it a fork you can simply clone repository A and push it to repository B. This is most of what a "fork" is.

    git clone git@bitbucket.com:user/repo
    cd repo
    git remote add my-clone git@bitbucket.com:you/repo-b
    git push --mirror my-clone
    
  2. If you need Bitbucket to call your fork a fork, you can take advantage of the fact that Bitbucket wikis are repositories to make a local copy of your wiki, then delete repository B, then fork repository A to repository B, then push the wiki back to repository B.

    git clone http://bitbucket.org/you/repo-b/wiki repo-b.wiki
    cd repo-b.wiki
    # Have a look at the files in repo-b.wiki and make sure they look complete
    # Then delete repository B from Bitbucket
    # Then fork repository A to repsitory B using the Bitbucket web UI
    # Then push the wiki back:
    git push origin master
    

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接