简体   繁体   English

Github:我有一个叉子叉子......我可以把它变成原始仓库的叉子吗?

[英]Github: I have a fork of a fork.. can I make it a fork of the original repo instead?

I have the following scenario: 我有以下场景:

.../orig-user/repo   # the original repo
.../user2/repo       # a fork of above
.../user3/repo       # a fork of .../user2/repo

is there any convenient way to "re-home" .../user3/repo so it becomes a 'direct' fork of .../orig-user/repo ? 是否有任何方便的方式“重新回家” .../user3/repo所以它成为.../orig-user/repo的'直接'分支?

Alternatively, is there a simple way for user3 to stay updated without involving user2 ? 或者,有没有一种简单的方法让user3在不涉及user2情况下保持更新?

You can change/add remote (say, upstream ) that will indicate /orig-user/repo . 您可以更改/添加指示/orig-user/repo remote (例如, upstream )。

If your upstream already exists, then change that url with /orig-user/repo. 如果您的上游已存在,则使用/ orig-user / repo更改该URL。

$ git remote -v      # see all the remotes
$ git remote set-url upstream <url-of-orig-user-repo>      # change the upstream url

Or, add a new upstream one. 或者,添加一个新的上游。

$ git remote add <upstream> <url-of-orig-user-repo>    # Add new remote/repositories 

Now when need to take the changes of /orig-user/repo repo just pull from upstream 现在当需要更改/orig-user/repo repo时,只需从upstream拉出来

$ git pull upstream master         # here, upstream is the remote of /orig-user/repo 

If you just want to allow user3 to push/pull from original repo : 如果您只想允许user3从原始仓库中推/拉:

How do I change which GitHub project I forked from? 如何更改我分叉的GitHub项目?

If you want to also change the "forked from ..." message in the repo : 如果您还想更改回购中的“forked from ...”消息:

Manually set 'forked from' to GitHub project 手动将'forked from'设置为GitHub项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM