3

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.

Amir
  • 10,600
  • 9
  • 48
  • 75
qtime67
  • 317
  • 5
  • 21

1 Answers1

2

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

http://sphinx.mythic-beasts.com/~mark/git-diff-help.png

A three dots diff will diff from the common ancestor (git merge-base foo master)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks Von - 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*. This being the case how can I diff between specific versions of each? – qtime67 Jun 07 '14 at 15:50
  • Thanks for your answer! Both this and the explanation on differences using `..` and `...`. It helped me a lot. – nmindz May 26 '17 at 04:08