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
)
来源:https://stackoverflow.com/questions/24098304/how-to-compare-diff-specific-version-of-master-and-fork-repo-in-github