1

This project is a fork of this. The fork has got 15,549 commits at the moment while the original one has 20,521 commits. Is there any easy way to know the commit in the original project which the fork is based out of?

The idea that crosses my mind is to clone both the repositories locally. Then pick-up each commit hash of the forked project from newest to oldest in order and try to find the same in the parent project. Is there a more elegant approach to achieve the same?

sherlock
  • 2,397
  • 3
  • 27
  • 44
  • 1
    If all you need to do is find the common ancestor between two branches, then [this might be helpful](http://stackoverflow.com/questions/1549146/find-common-ancestor-of-two-branches) to you. – Tim Biegeleisen Nov 14 '16 at 05:45
  • Possible duplicate of [Getting the difference between two repositories](http://stackoverflow.com/questions/1968512/getting-the-difference-between-two-repositories) – LeGEC Nov 14 '16 at 08:48
  • See also : [git-diff between cloned and original remote repository](https://stackoverflow.com/questions/5162800/git-diff-between-cloned-and-original-remote-repository) – LeGEC Nov 14 '16 at 08:51

2 Answers2

0

Fork is for repositories, not branches, therefore not just a single commit is the source. The whole repository is cloned.

Also, through pull requests the original can get updated from its fork, and if the fork has a longer lifetime, it gets update from the original as well.

This is how GitHub suggest syncing the repositories, you can use this to find the common code and the differences as well.

Zenima
  • 380
  • 2
  • 14
0

Create a local repo, with the two github links as remotes :

$ git clone https://github.com/tianocore/edk2
$ cd ed2k

# add second remote :
$ git remote add 96boards https://github.com/96boards/edk2
$ git fetch --all

You can then compare any itels from the two repos.

Branches in the first repo can be referred to using origin/{branch name}, branches in the second repo can be referred to using 96boards/{branch name}.

For example, to find the common commit on branch master :

$ git merge-base origin/master 96boards/master
LeGEC
  • 46,477
  • 5
  • 57
  • 104