Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github: comparing across forks?

Short version

When I compare two forks on Github, it does not compare the latest states, but the current state of the base fork with the last common commit (or am I wrong?); so how can I compare the latest states/heads on Github?

Longer version

I am trying to compare two repositories on Github.

It does not seem to compare the latest states of both repository. Instead, it compares:

  • the base fork as it was when both repositories where identical (last common commit?)

with

  • the head fork as it is now.

You can see this in the Github's fork comparison example, it says there are no changes between those two repositories, but there are now very different.

How can I compare the latest states/heads on Github?

like image 455
arthur.sw Avatar asked Jul 28 '15 08:07

arthur.sw


2 Answers

https://github.com/github/linguist/compare/master...gjtorikian:master

github:master is up to date with all commits from gjtorikian:master.
Try switching the base for your comparison.

It means that all commits from gjtorikian/liguist are part of github/linguist.

The reverse is not true:
https://github.com/gjtorikian/linguist/compare/master...github:master

That would give all (1866) commits from github/linguist which are not part of gjtorikian/linkguist.

This is triple-dot '...' diff between the common ancestor of two branches and the second branch (see "What are the differences between double-dot “..” and triple-dot “” in Git diff commit ranges?"):

git diff double and triple dots

In the first case github/linguist:master...gjtorikian/linguist:master, the common ancestor and gjtorikian/linguist:master are the same! O commits.

In the second case gjtorikian/linguist:master...github/linguist:master, github/linguist:master has 1866 commits since the common ancestor (here, since gjtorikian/linguist:master).

like image 113
VonC Avatar answered Oct 30 '22 02:10

VonC


As a side note, the compare of forks can be reached from the compare page.

Say your project is Zipios:

https://github.com/Zipios/Zipios

What you want to do is add the .../compare to that URL:

https://github.com/Zipios/Zipios/compare

On that page, you can select two branches but if you look closely, at the top there is a link that says: compare across forks.

Once you clicked on that link, it shows you two extra dropdowns with your main branch and the list of forks.

What I have yet to discover is how to go from the main page of a project to the Compare page. Maybe someone could shed light on that part?


From @somerandomdev49:

To go to the compare page, go to the "Pull Requests" tab and click the "Create Pull Request" button.

like image 44
Alexis Wilke Avatar answered Oct 30 '22 02:10

Alexis Wilke