Github 上有两个 repos:
“Repo1”是一个定期提交的大师(我还没有 fork ) “Repo2”是大约 2 年前的 Repo1 的一个分支(我还没有分支)
我想根据“Repo2”(大约 2 年前)分支的“Repo1”中的代码版本,在两个 Repos 之间进行 DIFF。我的目标是从“Repo1”中获取最新的代码,从“Repo2”中获取现在隔离的更改,并将它们 merge 到一个新的“Repo3”中,有效地将 2 年前添加到 fork 中的更改带入我的新“Repo1”的最新代码的分支。
我遇到的一个问题是,当我尝试从同一个 root/master 中 fork 多个 Fork 时,它似乎不起作用,只是将我指向第一个 fork。我在想我需要在本地克隆所有内容,然后在那里完成所需的工作,然后推回一个新的干净的 merge 存储库?
非常感谢任何指导。
最佳答案
I try to fork more than one Fork form the same root/master
您不必 fork 多个存储库:仅 fork 您打算贡献的存储库(通过 PR - Pull Request)。在这里,fork Repo1,然后在本地克隆它。
在您的本地克隆上,键入:
git remote add /url/repo2
git fetch repo2
然后你可以diff between master
and repo2/master
.
git diff repo2/master..master
查看更多信息“Showing which files have changed between git branches”
git diff --name-status repo2/master..master
OP qtime67添加 in the comments :
as Repo1 has moved on greatly since Repo2 was forked, I wish to first see only the core changes made between the original Fork (Repo2) and the version of Repo1 at the time the fork was made.
如“Git diff ..
? What's the difference between having ..
and no dots”中所述,将使用三个点:
git diff repo2/master...master
git diff master...repo2/master
三点差异将与共同祖先(git merge-base foo master
)不同
关于git - 如何在 github 中比较/区分 master 和 fork repo 的特定版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24098304/