Git - 合并来自其他存储库的文件

Git - Merge Files From Other Repository

是否可以(以及如何)合并来自不同存储库的文件,然后跟踪它们的拉取请求,即使您的存储库不是一个分支?

通常可以合并来自不同存储库的文件。只需添加多个遥控器,然后 select 您想要 pull/push 更改哪个 from/to。

但是,在我看来,这不是一个好的工作方式。它导致许多冲突,并使历史非常具有误导性。

It's because I have a fork of a repo and I'm not happy with the current maintainer. I want to make big sweeping changes that would make it basically a whole new repo I know the original maintainer won't merge. But I still want to be able to merge files from him and track his pulls and merges.

最简单的就是继续做一个fork,只是不发送pull requests。分叉对原始存储库和原始维护者没有任何义务。

如果你想完全休息,你可以在 Github 上创建一个新的存储库,将你的存储库发送到那里,然后手动将上游存储库设置为远程。

git remote add upstream <upstream-url>

假设您有 perl5i 的分支。您将在 Github 上创建一个新的存储库。按照上传现有存储库的正常说明进行操作。然后你会设置:

 git remote add upstream https://github.com/evalEmpire/perl5i.git

现在您可以从上游获取更新。

 git fetch upsteram