如何在github中比较/区分master和fork repo的特定版本 [英] How to compare/diff specific version of master and fork repo in github
问题描述
在Github上有两个回购站:
$ b
回购1是一个经常提交(尚未分给我)的主人
回购2是一个大约2年前的Repo1分支(尚未由我分叉)
我想在两个Repos之间做一个DIFF,基于 Repo1由Repo2(大约2年前)分支。我的目标是从Repo1获取最新的代码,以及现在与Repo2隔离的更改,并将它们合并到一个新的Repo3中,有效地将2年前添加到fork中的更改带入我的新最近代码为Repo1的分支。
我遇到的一个问题是,当我尝试将多个fork分叉到同一个root / master时似乎没有工作,只是指出我回到第一个叉。我想我需要克隆本地的everythign,并做所需的工作,然后推回到一个新的干净的合并回购?
任何指导非常赞赏。
我尝试将多个叉形式分支到相同的根/主模式
您不必分叉一个以上的回购:只分出您想要回购的回购(通过PR - Pull Request)。在这里,分叉Repo1,然后在本地克隆它。
在您的本地克隆上,键入:
git remote add / url / repo2
git fetch repo2
然后您可以在 master
和 repo2 / master
。
git diff repo2 / master..master
详情请参阅显示哪些文件已更改在git分支之间
git diff --name-status repo2 / master..master
OP qtime67 在评论中添加了:
由于Repo2已经分叉,因此Repo1已经大大地进步了,我希望首先看到原来的Fork(Repo2)和thpo在制作叉子时的Repo1版本。
如 Git diff ..
?具有 ..
且没有点的区别是什么?,那将使用三个点:
git diff repo2 / master ... master
git diff master ... repo2 / master
三点差异将从共同的祖先( git merge-base foo master
)
There are two repos on Github:
"Repo1" is a master that has regular commits (not yet forked by me) "Repo2" is a fork of Repo1 from about 2 years ago (not yet forked by me)
I want to do a DIFF between the two Repos, based on the version of code in "Repo1" that was branched by "Repo2" (approx 2 yrs ago). My objective is to then get the most recent code from "Repo1", and the now isolated changes from "Repo2", and merge these into a new "Repo3", effectively bringing the changes added to a fork 2 yrs ago, into my new fork of the most recent code of "Repo1".
One of the issues I am having is when I try to fork more than one Fork form the same root/master it doesnt seem to work, just points me back to the first fork. I am thinking I need to clone everythign locally, and do the required work there then push back to a new clean merged repo?
Any guidance much appreciated.
I try to fork more than one Fork form the same root/master
You don't have to fork more than one repo: fork only the repo you intent to contribute to (through PR - Pull Request). Here, fork Repo1, then clone it locally.
On your local clone, type:
git remote add /url/repo2
git fetch repo2
Then you can diff between master
and repo2/master
.
git diff repo2/master..master
See more at "Showing which files have changed between git branches"
git diff --name-status repo2/master..master
The OP qtime67 adds 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.
As described in "Git diff ..
? What's the difference between having ..
and no dots", that would be using three dots:
git diff repo2/master...master
git diff master...repo2/master
A three dots diff will diff from the common ancestor (git merge-base foo master
)
这篇关于如何在github中比较/区分master和fork repo的特定版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!