可以/我应该分叉我自己的github回购? [英] Can/should I fork my own github repo?

查看:178
本文介绍了可以/我应该分叉我自己的github回购?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的github repo被称为Programming-iOS-4-Book-Examples,因为它是我的书Programming iOS 4中的示例代码。现在我写了一本新书,改名为编程iOS 5。我需要使用旧名称保留原来的回购站,因为网上有链接,有人可能需要旧的代码。但是现在我还想要一个新的名为Programming-iOS-5-Book-Examples的新回购库,其中包含了针对iOS 5重写的相同示例(以及一些新的名称)。



很自然地,我看到了这个:我怎样才能把我自己的GitHub资料库?但是,建议使用分支机构。这不适用于我。我不想使用一个分支,因为它违背了给我一个可以链接的名称的目的。我希望公众能够在iOS 4回购中找到我的iOS 4示例,并在iOS 5回购中找到我的iOS 5示例。



这看起来像是一个完美的叉子,但是当我按下Fork按钮时什么也没有发生;我显然不允许分叉我自己的回购。



当然,我可以把这个全新的回购,但这意味着分开上传所有的资源,这是不幸的,因为在iOS 4回购中一切都已经正确。我是否必须这么做?

解决方案

最后,我做了这件事:


  1. 我重命名了现有的回购协议。这很好(谢谢,github,使这很容易)。不要忘了编辑你自己的git repo的 config 文件以保持你自己的master分支和github repo的master分支之间的远程分支关系。


  2. 我使用旧repo的名称创建了一个新的repo,除了提供现有repo新URL的 README.md 外没有其他任何东西。


因此,我并没有将iOS 4图书内容与iOS 5图书内容分开。相反,我重新安排了原始回购协议的结构,并给了它一个更通用的名称,尤其是与iOS 4无关。并且旧回购的现有链接不会中断,因为该URL有一个占位符回购,指向新的回购。


My github repo is called Programming-iOS-4-Book-Examples, because it's the example code from my book "Programming iOS 4". Now I've written a new edition of the book, retitled "Programming iOS 5". I need to leave the old repo in place with the old name, because there are links to it all over the net and someone might need the old code. But now I also want a new repo with a new name, Programming-iOS-5-Book-Examples, containing the same examples rewritten for iOS 5 (plus some new ones).

Naturally, I saw this: How can I fork my own GitHub repository? But the advice there is to use branches. That isn't going to work for me. I don't want to use a branch because that defeats the purpose of giving the repo a name that I can link to. I want the public to find my iOS 4 examples in the iOS 4 repo and my iOS 5 examples in the iOS 5 repo.

This seems like a perfect use of a fork, but when I press the Fork button nothing happens; I'm apparently not allowed to fork my own repo.

Of course I could just make this a whole new repo, but that would mean uploading all the resources separately, which is unfortunate because everything is already right there in the iOS 4 repo. Do I just have to do that anyway?

解决方案

In the end here's what I did:

  1. I renamed the existing repo. This works great (thanks, github, for making that so easy). Don't forget to edit your own git repo's config file to keep the remote branch relationship between your own master branch and the github repo's master branch.

  2. I created a new repo with the old repo's name, consisting of nothing but a README.md providing the existing repo's new URL.

Thus, I didn't end up separating the iOS 4 book content from the iOS 5 book content. Instead, I rearranged the structure of the original repo and gave it a more general name, not tied to iOS 4 in particular. And existing links to the old repo don't break, because there's a placeholder repo at that URL, pointing to the new repo.

这篇关于可以/我应该分叉我自己的github回购?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆